Function any
Summary
#include <include/EASTL/any.h>
(1) EA_CONSTEXPR any() EA_NOEXCEPT
(2) any(const any &other)
(3) any(any &&other) EA_NOEXCEPT
(4) template <class ValueType>
any(ValueType &&value, typename eastl::enable_if<!eastl::is_same< typename eastl::decay< ValueType >::type, any >::value >::type *=0)
(5) template <class T, class... Args>
explicit any(in_place_type_t< T >, Args &&... args)
(6) template <class T, class U, class... Args>
explicit any(in_place_type_t< T >, std::initializer_list< U > il, Args &&... args, typename eastl::enable_if< eastl::is_constructible< T, std::initializer_list< U > &, Args... >::value, void >::type *=0)
Function overload
Synopsis
#include <include/EASTL/any.h>
EA_CONSTEXPR any() EA_NOEXCEPT
Description
TODO(rparolin): renable constexpr for GCC.
Source
Lines 372-373 in include/EASTL/any.h.
any() EA_NOEXCEPT
: m_storage(), m_handler(nullptr) {}
Synopsis
#include <include/EASTL/any.h>
any(const any &other)
Description
No description yet.
Source
Lines 375-385 in include/EASTL/any.h.
any(const any& other) : m_handler(nullptr)
{
if (other.m_handler)
{
// NOTE(rparolin): You can not simply copy the underlying
// storage because it could hold a pointer to an object on the
// heap which breaks the copy semantics of the language.
other.m_handler(storage_operation::COPY, &other, this);
m_handler = other.m_handler;
}
}
Synopsis
#include <include/EASTL/any.h>
any(any &&other) EA_NOEXCEPT
Description
No description yet.
Source
Lines 387-398 in include/EASTL/any.h.
any(any&& other) EA_NOEXCEPT : m_handler(nullptr)
{
if(other.m_handler)
{
// NOTE(rparolin): You can not simply move the underlying
// storage because because the storage class has effectively
// type erased user type so we have to defer to the handler
// function to get the type back and pass on the move request.
m_handler = eastl::move(other.m_handler);
other.m_handler(storage_operation::MOVE, &other, this);
}
}
Synopsis
#include <include/EASTL/any.h>
template <class ValueType>
any(ValueType &&value, typename eastl::enable_if<!eastl::is_same< typename eastl::decay< ValueType >::type, any >::value >::type *=0)
Description
No description yet.
Source
Lines 402-410 in include/EASTL/any.h.
template <class ValueType>
any(ValueType&& value,
typename eastl::enable_if<!eastl::is_same<typename eastl::decay<ValueType>::type, any>::value>::type* = 0)
{
typedef decay_t<ValueType> DecayedValueType;
static_assert(is_copy_constructible<DecayedValueType>::value, "ValueType must be copy-constructible");
storage_handler<DecayedValueType>::construct(m_storage, eastl::forward<ValueType>(value));
m_handler = &storage_handler<DecayedValueType>::handler_func;
}
Synopsis
#include <include/EASTL/any.h>
template <class T, class... Args>
explicit any(in_place_type_t< T >, Args &&... args)
Description
No description yet.
Source
Lines 412-420 in include/EASTL/any.h.
template <class T, class... Args>
explicit any(in_place_type_t<T>, Args&&... args)
{
typedef storage_handler<decay_t<T>> StorageHandlerT;
static_assert(eastl::is_constructible<T, Args...>::value, "T must be constructible with Args...");
StorageHandlerT::construct_inplace(m_storage, eastl::forward<Args>(args)...);
m_handler = &StorageHandlerT::handler_func;
}
Synopsis
#include <include/EASTL/any.h>
template <class T, class U, class... Args>
explicit any(in_place_type_t< T >, std::initializer_list< U > il, Args &&... args, typename eastl::enable_if< eastl::is_constructible< T, std::initializer_list< U > &, Args... >::value, void >::type *=0)
Description
No description yet.
Source
Lines 422-433 in include/EASTL/any.h.
template <class T, class U, class... Args>
explicit any(in_place_type_t<T>,
std::initializer_list<U> il,
Args&&... args,
typename eastl::enable_if<eastl::is_constructible<T, std::initializer_list<U>&, Args...>::value,
void>::type* = 0)
{
typedef storage_handler<decay_t<T>> StorageHandlerT;
StorageHandlerT::construct_inplace(m_storage, il, eastl::forward<Args>(args)...);
m_handler = &StorageHandlerT::handler_func;
}