##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::basic_regex::operator=

From cppreference.com
< cpp‎ | regex‎ | basic regex

Defined in header `<regex>` |  |
basic_regex& operator=( const basic_regex& other ); | (1) | (since C++11)
basic_regex& operator=( basic_regex&& other ); | (2) | (since C++11)
basic_regex& operator=( const CharT* ptr ); | (3) | (since C++11)
basic_regex& operator=( std::initializer_list<CharT> il ); | (4) | (since C++11)
template< class ST, class SA > basic_regex& operator=( const std::basic_string<CharT,ST,SA>& p ); | (5) | (since C++11)

Assigns the contents.

1) Copy assignment operator. Assigns the contents of `other`. Equivalent to assign(other);.
2) Move assignment operator. Assigns the contents of `other` using move semantics. `other` is in valid, but unspecified state after the operation. Equivalent to assign(other);.
3) Assigns a null-terminated character string pointed to by `ptr`. Equivalent to assign(ptr);.
4) Assigns characters contained in initializer list `il`. Equivalent to assign(il);.
5) Assigns the contents of the string `p`. Equivalent to assign(p);.

### [edit] Parameters

other | - | another regex object
ptr | - | pointer to a null-terminated character string
il | - | initializer list containing characters to assign
p | - | string containing characters to assign

### [edit] Return value

*this.

### [edit] Exceptions

1) (none)
2)
`noexcept` specification:
noexcept
3-5) (none)

### [edit] See also

assign | assigns the contents (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/regex/basic_regex/operator%3D&oldid=91756"
Category:

- unconditionally noexcept

Hidden categories:

- Pages with unreviewed unconditional noexcept template
- Pages with unreviewed noexcept template