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

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::any::any

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

any(); | (1) | (library fundamentals TS)
any(const any& other); | (2) | (library fundamentals TS)
any(any&& other); | (3) | (library fundamentals TS)
template<typename ValueType> any(ValueType&& value); | (4) | (library fundamentals TS)
template <class Allocator> any(std::allocator_arg_t, const Allocator& a); | (5) | (library fundamentals TS)
template <class Allocator, typename ValueType> any(std::allocator_arg_t, const Allocator& a, ValueType&& value); | (6) | (library fundamentals TS)
template <class Allocator> any(std::allocator_arg_t, const Allocator& a, const any& other); | (7) | (library fundamentals TS)
template <class Allocator> any(std::allocator_arg_t, const Allocator& a, any&& other); | (8) | (library fundamentals TS)

Constructs a new `any` object.

1) Constructs an empty object.
2-3) Copies (2) or moves (3) content of `other` into a new instance, so that any content is equivalent in both type and value to `other`, or empty if `other` is empty.
4) Constructs an object with initial content equivalent in both type and value to `value`.
5-8) Equivalent to the preceding constructors except that the stored value is constructed using the supplied allocator instance.

### [edit] Template parameters

ValueType | - | contained value type
Allocator | - | `Allocator` type used to allocate internal storage
Type requirements
- `ValueType` must meet the requirements of `CopyConstructible`.
- `Allocator` must meet the requirements of `Allocator`.

### [edit] Parameters

other | - | another `any` object to copy or move from
value | - | value to initialize the contained value with
a | - | instance of an allocator to use for allocating the contained value

### [edit] Exceptions

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

### [edit] See also

operator= | assigns an `any` object (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/any/any&oldid=71491"
Category:

- unconditionally noexcept