void swap(any& x, any& y) noexcept;
Effects: As if by x.swap(y).
template <class T, class... Args> any make_any(Args&& ...args);
Effects: Equivalent to: return any(in_place_type<T>, std::forward<Args>(args)...);
template <class T, class U, class... Args> any make_any(initializer_list<U> il, Args&& ...args);
Effects: Equivalent to: return any(in_place_type<T>, il, std::forward<Args>(args)...);
template<class T> T any_cast(const any& operand); template<class T> T any_cast(any& operand); template<class T> T any_cast(any&& operand);
Let U be the type remove_cv_t<remove_reference_t<ValueType>>.
Requires: For the first overload, is_constructible_v<ValueType, const U&> is true. For the second overload, is_constructible_v<ValueType, U&> is true. For the third overload, is_constructible_v<ValueType, U> is true. Otherwise the program is ill-formed.
Returns: For the first and second overload, static_cast<ValueType>(*any_cast<U>(&operand)). For the third overload, static_cast<ValueType>(std::move(*any_cast<U>(&operand))).
Throws: bad_any_cast if operand.type() != typeid(remove_reference_t<T>).
[ Example:
any x(5); assert(any_cast<int>(x) == 5); any_cast<int&>(x) = 10; assert(any_cast<int>(x) == 10); x = "Meow"; assert(strcmp(any_cast<const char*>(x), "Meow") == 0); any_cast<const char*&>(x) = "Harry"; assert(strcmp(any_cast<const char*>(x), "Harry") == 0); x = string("Meow"); string s, s2("Jane"); s = move(any_cast<string&>(x)); assert(s == "Meow"); any_cast<string&>(x) = move(s2); assert(any_cast<const string&>(x) == "Jane"); string cat("Meow"); const any y(cat); assert(any_cast<const string&>(y) == cat); any_cast<string&>(y);
— end example ]
template<class T> const T* any_cast(const any* operand) noexcept; template<class T> T* any_cast(any* operand) noexcept;
Returns: If operand != nullptr && operand->type() == typeid(T), a pointer to the object contained by operand; otherwise, nullptr.
[ Example:
bool is_string(const any& operand) { return any_cast<string>(&operand) != nullptr; }
— end example ]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4