Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
linb::final Class Reference

#include <any.hpp>

List of all members.

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 ()
 Constructs an object of type any with an empty state.
 any (const any &rhs)
 Constructs an object of type any with an equivalent state as other.
 any (any &&rhs) noexcept
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.
bool empty () const noexcept
 Returns true if *this has no contained object, otherwise false.
anyoperator= (const any &rhs)
 Has the same effect as any(rhs).swap(*this). No effects if an exception is thrown.
anyoperator= (any &&rhs) noexcept
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.
const std::type_info & type () const noexcept
 If *this has a contained object of type T, typeid(T); otherwise typeid(void).
 ~any ()
 Same effect as this->clear().

Protected Member Functions

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

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)

Static Private Member Functions

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

Private Attributes

storage_union storage
vtable_typevtable

Friends

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

Detailed Description

Definition at line 35 of file any.hpp.


Constructor & Destructor Documentation

linb::final::~any ( ) [inline]

Same effect as this->clear().

Definition at line 67 of file any.hpp.


Member Function Documentation

linb::final::any ( ) [inline]

Constructs an object of type any with an empty state.

Definition at line 39 of file any.hpp.

linb::final::any ( const any rhs) [inline]

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

Definition at line 45 of file any.hpp.

linb::final::any ( any &&  rhs) [inline]

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 56 of file any.hpp.

template<typename ValueType , typename = typename std::enable_if<!std::is_same<typename std::decay<ValueType>::type, any>::value>::type>
linb::final::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 77 of file any.hpp.

template<typename T >
const T* linb::final::cast ( ) const [inline, protected]

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

Definition at line 318 of file any.hpp.

template<typename T >
T* linb::final::cast ( ) [inline, protected]

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

Definition at line 327 of file any.hpp.

void linb::final::clear ( ) [inline]

If not empty, destroys the contained object.

Definition at line 115 of file any.hpp.

template<typename ValueType >
void linb::final::construct ( ValueType &&  value) [inline, private]

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 355 of file any.hpp.

template<typename ValueType , typename T >
std::enable_if<requires_allocation<T>::value>::type linb::final::do_construct ( ValueType &&  value) [inline, private]

Definition at line 340 of file any.hpp.

template<typename ValueType , typename T >
std::enable_if<!requires_allocation<T>::value>::type linb::final::do_construct ( ValueType &&  value) [inline, private]

Definition at line 347 of file any.hpp.

bool linb::final::empty ( ) const [inline]

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

Definition at line 125 of file any.hpp.

static bool linb::final::is_same ( const std::type_info &  a,
const std::type_info &  b 
) [inline, static, protected]

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 307 of file any.hpp.

bool linb::final::is_typed ( const std::type_info &  t) const [inline, protected]

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

Definition at line 296 of file any.hpp.

any& linb::final::operator= ( const any rhs) [inline]

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

Definition at line 85 of file any.hpp.

any& linb::final::operator= ( any &&  rhs) [inline]

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 95 of file any.hpp.

template<typename ValueType , typename = typename std::enable_if<!std::is_same<typename std::decay<ValueType>::type, any>::value>::type>
any& linb::final::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 106 of file any.hpp.

void linb::final::swap ( any rhs) [inline]

Exchange the states of *this and rhs.

Definition at line 137 of file any.hpp.

const std::type_info& linb::final::type ( ) const [inline]

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

Definition at line 131 of file any.hpp.

template<typename T >
static vtable_type* linb::final::vtable_for_type ( ) [inline, static, private]

Returns the pointer to the vtable of the type T.

Definition at line 278 of file any.hpp.


Friends And Related Function Documentation

template<typename T >
const 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 429 of file any.hpp.

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 440 of file any.hpp.


Member Data Documentation

Definition at line 335 of file any.hpp.

Definition at line 336 of file any.hpp.


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


libnabo
Author(s): Stéphane Magnenat
autogenerated on Sun Feb 10 2019 03:52:20