std::basic_regex::assign(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ NAME ✨

std::basic_regex::assign β€” std::basic_regex::assign. From the C++ Standard Libary, this is the assignment glow-up for regular expressions. Page std::basic_regex::assign(3), bestie. πŸ’…

🧚 Synopsis 🧚

Okay so here's the overload lineup, and every single one is since C++11:

(1) (since C++11)

basic_regex& assign( const basic_regex& other );

(2) (since C++11)

basic_regex& assign( basic_regex&& other ) noexcept;

(3) (since C++11)

basic_regex& assign( const CharT* s,
                     flag_type f =
                     std::regex_constants::ECMAScript );

(4) (since C++11)

basic_regex& assign( const CharT* ptr, std::size_t count,
                     flag_type f =
                     std::regex_constants::ECMAScript );

(5) (since C++11)

template< class ST, class SA >
basic_regex& assign( const std::basic_string<CharT,ST,SA>& str,
                     flag_type f =
                     std::regex_constants::ECMAScript );

(6) (since C++11)

template< class InputIt >
basic_regex& assign( InputIt first, InputIt last,
                     flag_type f =
                     std::regex_constants::ECMAScript );

(7) (since C++11)

basic_regex& assign( std::initializer_list<CharT> ilist,
                     flag_type f =
                     std::regex_constants::ECMAScript );

So like, assign assigns the contents to the regular expression. That's the whole main-character job. ✨

  1. Assigns the contents of other. After the call, flags() and mark_count() are equivalent to the values of other.flags() and other.mark_count().
  2. Assigns the contents of other using move semantics. flags() and mark_count() are equivalent to the values of other.flags() and other.mark_count() before the assignment. After the call, other is in a valid, but unspecified state. 🫢

3-7) β€” Assigns a sequence of characters to the regular expression. The syntax flags are set to f. mark_count() returns the number of marked subexpressions within the resulting subexpression after the call.

  • 3) β€” Assigns a null-terminated string pointed to by s.
  • 4) β€” Assigns a sequence of count characters, pointed to by s.
  • 5) β€” Assigns the string str.
  • 6) β€” Assigns the characters in the range [first, last).
  • 7) β€” Assigns the characters in the initializer list ilist.

πŸŽ€ Parameters πŸŽ€

  • other β€” another regular expression to assign
  • s β€” pointer to a character sequence to assign
  • str β€” string to assign
  • first, last β€” the range of characters to assign
  • ilist β€” initializer list containing characters to assign

🌸 Type requirements 🌸

  • InputIt must meet the requirements of LegacyInputIterator.

πŸ”₯ Return value πŸ”₯

*this

😭 Exceptions 😭

  • 1) β€” May throw implementation-defined exceptions.
  • 3-7) β€” std::regex_error if the supplied regular expression is not valid. The object is not modified in that case.

πŸ’€ Example πŸ’€

This section is incomplete.

Reason: no example.

πŸ‘‘ See also πŸ‘‘

  • operator= β€” assigns the contents (public member function)

πŸ“ Category πŸ“

  • * Todo no example

Okay that's the whole page, bestie β€” source http://cppreference.com, version/date 2024.06.10, page std::basic_regex::assign(3). πŸ’–βœ¨

πŸ“¦ where this page comes from