home | help
std::experi...al::any_cast(3)  C++ Standard Libary std::experi...al::any_cast(3)

NAME
     std::experimental::any_cast - std::experimental::any_cast

Synopsis
	template<class ValueType>			       (1) (library fun-
     damentals TS)
	    ValueType any_cast(const any& operand);
	template<class ValueType>			       (2) (library fun-
     damentals TS)
	    ValueType any_cast(any& operand);
	template<class ValueType>			       (3) (library fun-
     damentals TS)
	    ValueType any_cast(any&& operand);
	template<class ValueType>
	    const ValueType* any_cast(const any* operand)      (4) (library fun-
     damentals TS)
	noexcept;
	template<class ValueType>			       (5) (library fun-
     damentals TS)
	    ValueType* any_cast(any* operand) noexcept;

	Performs type-safe access to the contained object.

	For (1-3), the program is ill-formed if ValueType is not a reference and
	std::is_copy_constructible<ValueType>::value is false.

Parameters
	operand - target any object

Return value
	1) Returns
	*any_cast<std::add_const_t<std::remove_reference_t<Value-
     Type>>>(&operand).
	2,3) Returns *any_cast<std::remove_reference_t<ValueType>>(&operand).
	4,5)  If  operand is not a null pointer, and the typeid of the requested
     ValueType
	matches that of the contents of operand, a pointer  to	the  value  con-
     tained by
	operand, otherwise a null pointer.

Exceptions
	1-3)  Throws  bad_any_cast if the typeid of the requested ValueType does
     not match
	that of the contents of operand.

Category:
	  * Noindexed pages

http://cppreference.com 	   2024.06.10	   std::experi...al::any_cast(3)

home | help