std::experimental::any::operator= - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::any::operator=

From cppreference.com
< cpp‎ | experimental‎ | any

any& operator=(const any& rhs); | (1) | (library fundamentals TS)
any& operator=(any&& rhs); | (2) | (library fundamentals TS)
template<typename ValueType> any& operator=(ValueType&& rhs); | (3) | (library fundamentals TS)

Assigns contents to the contained value.

1-2) Assigns by copying (1) or moving(2) the value of `rhs`.
3) Assigns the type and value of `rhs`.

### [edit] Template parameters

ValueType | - | contained value type
Type requirements
- `ValueType` must meet the requirements of `CopyConstructible`.

### [edit] Parameters

rhs | - | object whose contained value to assign

### [edit] Return value

*this

### [edit] Exceptions

2)
`noexcept` specification:
noexcept
1,3) Throws bad_alloc or any exception thrown by the constructor of the contained type.

### [edit] See also

(constructor) | constructs an `any` object (public member function) [edit]

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

- unconditionally noexcept