Difference between revisions of "cpp/utility/any/make any"
From cppreference.com
(Fixed editorially) |
(p0504r0.: in_place<T> -> in_place_type<T>) |
||
Line 14: | Line 14: | ||
Constructs an {{tt|any}} object containing an object of type {{tt|T}}, passing the provided arguments to {{tt|T}}'s constructor. | Constructs an {{tt|any}} object containing an object of type {{tt|T}}, passing the provided arguments to {{tt|T}}'s constructor. | ||
− | @1@ Equivalent to {{c|return std::any(std:: | + | @1@ Equivalent to {{c|return std::any(std::in_place_type<T>, std::forward<Args>(args)...); }} |
− | @2@ Equivalent to {{c|return std::any(std:: | + | @2@ Equivalent to {{c|return std::any(std::in_place_type<T>, il, std::forward<Args>(args)...); }} |
=== See also === | === See also === |
Revision as of 09:20, 16 November 2016
template< class T, class... Args > std::any make_any( Args&&... args ); |
(1) | (since C++17) |
template< class T, class U, class... Args > std::any make_any( std::initializer_list<U> il, Args&&... args ); |
(2) | (since C++17) |
Constructs an any
object containing an object of type T
, passing the provided arguments to T
's constructor.
1) Equivalent to return std::any(std::in_place_type<T>, std::forward<Args>(args)...);
2) Equivalent to return std::any(std::in_place_type<T>, il, std::forward<Args>(args)...);
See also
constructs an any object (public member function) |