Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZStd::any Class Reference

#include <any.h>

Classes

struct  type_info
 

Public Types

enum class  Action {
  Reserve , Construct , Copy , Move ,
  Destruct , Destroy
}
 
using type_id = AZ::Uuid
 Typed used to identify other types (acquired via azrtti_typeid<Type>())
 
using action_handler_for_t = type_info::HandleFnT
 

Public Member Functions

 AZ_TYPE_INFO (AZStd::any, "{03924488-C7F4-4D6D-948B-ABC2D1AE2FD3}")
 
 AZ_CLASS_ALLOCATOR (any, AZ::SystemAllocator)
 
 any (allocator alloc=allocator("AZStd::any"))
 Constructs an empty object.
 
 any (const any &val)
 Copies content of val into a new instance.
 
 any (any &&val)
 Moves content of val into a new instance.
 
 any (const void *pointer, const type_info &typeInfo)
 [Extension] Create an any with a custom typeinfo (copies value in pointer using typeInfo)
 
 any (transfer_ownership_t, void *pointer, const type_info &typeInfo)
 [Extension] Create an any with a custom typeinfo (takes ownership of value in pointer using typeInfo)
 
template<typename ValueType , typename... Args>
 any (const type_info &typeInfo, in_place_type_t< ValueType >, Args &&... args)
 [Extension] Create an any with a custom typeinfo while forwarding the arguments to ValueType constructor
 
template<typename ValueType , typename U , typename... Args>
 any (const type_info &typeInfo, in_place_type_t< ValueType >, AZStd::initializer_list< U > il, Args &&... args)
 [Extension] Create an any with a custom typeinfo while forwarding the initializer_list and variadic arguments to ValueType constructor
 
template<typename ValueType , typename = enable_if_t<!is_same<decay_t<ValueType>, any>::value>>
 any (ValueType &&val, allocator alloc=allocator("AZStd::any"))
 Constructs an object with initial content an object of type decay_t<ValueType>, direct-initialized from forward<ValueType>(val)
 
template<typename ValueType , typename... Args>
 any (in_place_type_t< ValueType >, Args &&... args)
 Constructs an object with initial content of type decay_t<ValueType>, direct-non-list-initialized from forward<Args>(args)...
 
template<typename ValueType , typename U , typename... Args>
 any (in_place_type_t< ValueType >, AZStd::initializer_list< U > il, Args &&... args)
 Constructs an object with initial content of type decay_t<ValueType>, direct-non-list-initialized from il, forward<Args>(args)...
 
 ~any ()
 Destroys the contained object, if any, as if by a call to clear()
 
anyoperator= (const any &val)
 Copies content of val into this (via any(val).swap(*this))
 
anyoperator= (any &&val)
 Moves content of val into this (via any(move(val)).swap(*this))
 
template<typename ValueType , typename = enable_if_t<!is_same<decay_t<ValueType>, any>::value>>
anyoperator= (ValueType &&val)
 Assigns the type and value of rhs (via any(forward<ValueType>(val)).swap(*this))
 
void clear ()
 If not empty, destroys the contained object.
 
void swap (any &other)
 Swaps the content of two any objects.
 
bool empty () const
 Returns true if this hasn't been initialized yet or has been cleared.
 
type_id type () const
 Returns the type id of the stored type.
 
template<typename ValueType >
bool is () const
 Helper for checking type equality.
 
const type_infoget_type_info () const
 

Static Public Member Functions

template<typename T >
static constexpr auto get_action_handler_for_t ()
 

Friends

template<typename ValueType >
add_pointer_t< ValueType > any_cast (any *)
 

Detailed Description

The class any describes a type-safe container for single values of any type.

See C++ Standard proposal n3804 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3804.html) And docs (http://en.cppreference.com/w/cpp/utility/any)


The documentation for this class was generated from the following file: