Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
linb::any Class Referencefinal

#include <any.hpp>

Classes

struct  requires_allocation
 Whether the type T must be dynamically allocated or can be stored on the stack. More...
 
union  storage_union
 
struct  vtable_dynamic
 VTable for dynamically allocated storage. More...
 
struct  vtable_stack
 VTable for stack allocated storage. More...
 
struct  vtable_type
 Base VTable specification. More...
 

Public Member Functions

 any () noexcept
 Constructs an object of type any with an empty state. More...
 
 any (any &&rhs) noexcept
 
 any (const any &rhs)
 Constructs an object of type any with an equivalent state as other. More...
 
template<typename ValueType , typename... Args>
 any (in_place_type_t< ValueType >, Args &&... args)
 
template<typename ValueType , typename U , typename... Args>
 any (in_place_type_t< ValueType >, std::initializer_list< U > il, Args &&... args)
 
template<typename ValueType , typename = typename std::enable_if<!std::is_same<typename std::decay<ValueType>::type, any>::value>::type>
 any (ValueType &&value)
 
void clear () noexcept
 If not empty, destroys the contained object. More...
 
bool empty () const noexcept
 Returns true if *this has no contained object, otherwise false. More...
 
anyoperator= (any &&rhs) noexcept
 
anyoperator= (const any &rhs)
 Has the same effect as any(rhs).swap(*this). No effects if an exception is thrown. More...
 
template<typename ValueType , typename = typename std::enable_if<!std::is_same<typename std::decay<ValueType>::type, any>::value>::type>
anyoperator= (ValueType &&value)
 
void swap (any &rhs) noexcept
 Exchange the states of *this and rhs. More...
 
const std::type_info & type () const noexcept
 If *this has a contained object of type T, typeid(T); otherwise typeid(void). More...
 
 ~any ()
 Same effect as this->clear(). More...
 

Protected Member Functions

template<typename T >
const T * cast () const noexcept
 Casts (with no type_info checks) the storage pointer as const T*. More...
 
template<typename T >
T * cast () noexcept
 Casts (with no type_info checks) the storage pointer as T*. More...
 
bool is_typed (const std::type_info &t) const
 Same effect as is_same(this->type(), t);. More...
 

Static Protected Member Functions

static bool is_same (const std::type_info &a, const std::type_info &b)
 

Private Member Functions

template<typename ValueType >
void construct (ValueType &&value)
 
template<typename ValueType , typename T >
std::enable_if< requires_allocation< T >::value >::type do_construct (ValueType &&value)
 
template<typename ValueType , typename T >
std::enable_if<!requires_allocation< T >::value >::type do_construct (ValueType &&value)
 
template<typename T , typename... Args>
std::enable_if< requires_allocation< T >::value >::type do_emplace (Args &&... args)
 
template<typename T , typename... Args>
std::enable_if<!requires_allocation< T >::value >::type do_emplace (Args &&... args)
 
template<typename ValueType , typename... Args>
void emplace_construct (Args &&... args)
 

Static Private Member Functions

template<typename T >
static vtable_typevtable_for_type ()
 Returns the pointer to the vtable of the type T. More...
 

Private Attributes

storage_union storage
 
vtable_typevtable
 

Friends

template<typename T >
T * any_cast (any *operand) noexcept
 
template<typename T >
const friend T * any_cast (const any *operand) noexcept
 

Detailed Description

Definition at line 66 of file include/behaviortree_cpp/contrib/any.hpp.

Constructor & Destructor Documentation

◆ any() [1/6]

linb::any::any ( )
inlinenoexcept

Constructs an object of type any with an empty state.

Definition at line 70 of file include/behaviortree_cpp/contrib/any.hpp.

◆ any() [2/6]

linb::any::any ( const any rhs)
inline

Constructs an object of type any with an equivalent state as other.

Definition at line 76 of file include/behaviortree_cpp/contrib/any.hpp.

◆ any() [3/6]

linb::any::any ( any &&  rhs)
inlinenoexcept

Constructs an object of type any with a state equivalent to the original state of other. rhs is left in a valid but otherwise unspecified state.

Definition at line 87 of file include/behaviortree_cpp/contrib/any.hpp.

◆ ~any()

linb::any::~any ( )
inline

Same effect as this->clear().

Definition at line 98 of file include/behaviortree_cpp/contrib/any.hpp.

◆ any() [4/6]

template<typename ValueType , typename = typename std::enable_if<!std::is_same<typename std::decay<ValueType>::type, any>::value>::type>
linb::any::any ( ValueType &&  value)
inline

Constructs an object of type any that contains an object of type T direct-initialized with std::forward<ValueType>(value).

T shall satisfy the CopyConstructible requirements, otherwise the program is ill-formed. This is because an any may be copy constructed into another any at any time, so a copy should always be allowed.

Definition at line 108 of file include/behaviortree_cpp/contrib/any.hpp.

◆ any() [5/6]

template<typename ValueType , typename... Args>
linb::any::any ( in_place_type_t< ValueType >  ,
Args &&...  args 
)
inlineexplicit

Definition at line 116 of file include/behaviortree_cpp/contrib/any.hpp.

◆ any() [6/6]

template<typename ValueType , typename U , typename... Args>
linb::any::any ( in_place_type_t< ValueType >  ,
std::initializer_list< U >  il,
Args &&...  args 
)
inlineexplicit

Definition at line 122 of file include/behaviortree_cpp/contrib/any.hpp.

Member Function Documentation

◆ cast() [1/2]

template<typename T >
const T* linb::any::cast ( ) const
inlineprotectednoexcept

Casts (with no type_info checks) the storage pointer as const T*.

Definition at line 378 of file include/behaviortree_cpp/contrib/any.hpp.

◆ cast() [2/2]

template<typename T >
T* linb::any::cast ( )
inlineprotectednoexcept

Casts (with no type_info checks) the storage pointer as T*.

Definition at line 387 of file include/behaviortree_cpp/contrib/any.hpp.

◆ clear()

void linb::any::clear ( )
inlinenoexcept

If not empty, destroys the contained object.

Definition at line 157 of file include/behaviortree_cpp/contrib/any.hpp.

◆ construct()

template<typename ValueType >
void linb::any::construct ( ValueType &&  value)
inlineprivate

Chooses between stack and dynamic allocation for the type decay_t<ValueType>, assigns the correct vtable, and constructs the object on our storage.

Definition at line 437 of file include/behaviortree_cpp/contrib/any.hpp.

◆ do_construct() [1/2]

template<typename ValueType , typename T >
std::enable_if<requires_allocation<T>::value>::type linb::any::do_construct ( ValueType &&  value)
inlineprivate

Definition at line 422 of file include/behaviortree_cpp/contrib/any.hpp.

◆ do_construct() [2/2]

template<typename ValueType , typename T >
std::enable_if<!requires_allocation<T>::value>::type linb::any::do_construct ( ValueType &&  value)
inlineprivate

Definition at line 429 of file include/behaviortree_cpp/contrib/any.hpp.

◆ do_emplace() [1/2]

template<typename T , typename... Args>
std::enable_if<requires_allocation<T>::value>::type linb::any::do_emplace ( Args &&...  args)
inlineprivate

Definition at line 399 of file include/behaviortree_cpp/contrib/any.hpp.

◆ do_emplace() [2/2]

template<typename T , typename... Args>
std::enable_if<!requires_allocation<T>::value>::type linb::any::do_emplace ( Args &&...  args)
inlineprivate

Definition at line 405 of file include/behaviortree_cpp/contrib/any.hpp.

◆ emplace_construct()

template<typename ValueType , typename... Args>
void linb::any::emplace_construct ( Args &&...  args)
inlineprivate

Definition at line 411 of file include/behaviortree_cpp/contrib/any.hpp.

◆ empty()

bool linb::any::empty ( ) const
inlinenoexcept

Returns true if *this has no contained object, otherwise false.

Definition at line 167 of file include/behaviortree_cpp/contrib/any.hpp.

◆ is_same()

static bool linb::any::is_same ( const std::type_info &  a,
const std::type_info &  b 
)
inlinestaticprotected

Checks if two type infos are the same.

If ANY_IMPL_FAST_TYPE_INFO_COMPARE is defined, checks only the address of the type infos, otherwise does an actual comparision. Checking addresses is only a valid approach when there's no interaction with outside sources (other shared libraries and such).

Definition at line 366 of file include/behaviortree_cpp/contrib/any.hpp.

◆ is_typed()

bool linb::any::is_typed ( const std::type_info &  t) const
inlineprotected

Same effect as is_same(this->type(), t);.

Definition at line 353 of file include/behaviortree_cpp/contrib/any.hpp.

◆ operator=() [1/3]

any& linb::any::operator= ( any &&  rhs)
inlinenoexcept

Has the same effect as any(std::move(rhs)).swap(*this).

The state of *this is equivalent to the original state of rhs and rhs is left in a valid but otherwise unspecified state.

Definition at line 137 of file include/behaviortree_cpp/contrib/any.hpp.

◆ operator=() [2/3]

any& linb::any::operator= ( const any rhs)
inline

Has the same effect as any(rhs).swap(*this). No effects if an exception is thrown.

Definition at line 127 of file include/behaviortree_cpp/contrib/any.hpp.

◆ operator=() [3/3]

template<typename ValueType , typename = typename std::enable_if<!std::is_same<typename std::decay<ValueType>::type, any>::value>::type>
any& linb::any::operator= ( ValueType &&  value)
inline

Has the same effect as any(std::forward<ValueType>(value)).swap(*this). No effect if a exception is thrown.

T shall satisfy the CopyConstructible requirements, otherwise the program is ill-formed. This is because an any may be copy constructed into another any at any time, so a copy should always be allowed.

Definition at line 148 of file include/behaviortree_cpp/contrib/any.hpp.

◆ swap()

void linb::any::swap ( any rhs)
inlinenoexcept

Exchange the states of *this and rhs.

Definition at line 181 of file include/behaviortree_cpp/contrib/any.hpp.

◆ type()

const std::type_info& linb::any::type ( ) const
inlinenoexcept

If *this has a contained object of type T, typeid(T); otherwise typeid(void).

Definition at line 174 of file include/behaviortree_cpp/contrib/any.hpp.

◆ vtable_for_type()

template<typename T >
static vtable_type* linb::any::vtable_for_type ( )
inlinestaticprivate

Returns the pointer to the vtable of the type T.

Definition at line 331 of file include/behaviortree_cpp/contrib/any.hpp.

Friends And Related Function Documentation

◆ any_cast [1/2]

template<typename T >
T* any_cast ( any operand)
friend

If operand != nullptr && operand->type() == typeid(ValueType), a pointer to the object contained by operand, otherwise nullptr.

Definition at line 525 of file include/behaviortree_cpp/contrib/any.hpp.

◆ any_cast [2/2]

template<typename T >
const friend T* any_cast ( const any operand)
friend

If operand != nullptr && operand->type() == typeid(ValueType), a pointer to the object contained by operand, otherwise nullptr.

Definition at line 508 of file include/behaviortree_cpp/contrib/any.hpp.

Member Data Documentation

◆ storage

storage_union linb::any::storage
private

Definition at line 395 of file include/behaviortree_cpp/contrib/any.hpp.

◆ vtable

vtable_type* linb::any::vtable
private

Definition at line 396 of file include/behaviortree_cpp/contrib/any.hpp.


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


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:10