Project Alice
Loading...
Searching...
No Matches
cyto_any.hpp File Reference
#include <exception>
#include <initializer_list>
#include <new>
#include <type_traits>
#include <typeinfo>
#include <utility>
#include <string.h>
Include dependency graph for cyto_any.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Cyto::IsInPlaceType_< T >
 
struct  Cyto::IsInPlaceType_< std::in_place_t >
 
struct  Cyto::IsInPlaceType_< std::in_place_type_t< T > >
 
struct  Cyto::IsInPlaceType_< std::in_place_index_t< S > >
 
union  Cyto::Storage
 
struct  Cyto::fallback_typeinfo< T >
 
struct  Cyto::AnyActions
 
struct  Cyto::AnyTraits< T >
 
class  Cyto::Any
 

Namespaces

namespace  Cyto
 

Macros

#define ANY_ALWAYS_INLINE   inline
 
#define ANY_USE_TYPEINFO   0
 
#define ANY_USE_EXCEPTIONS   0
 
#define ANY_USE_SMALL_MEMCPY_STRATEGY   1
 
#define ANY_USE(FEATURE)   (defined ANY_USE_##FEATURE && ANY_USE_##FEATURE)
 

Typedefs

using Cyto::StorageBuffer = std::aligned_storage_t< StorageBufferSize, std::alignment_of_v< void * > >
 
template<class T >
using Cyto::IsStorageBufferSized_ = std::bool_constant< sizeof(T)<=sizeof(StorageBuffer) &&std::alignment_of_v< StorageBuffer > % std::alignment_of_v< T >==0 >
 
template<class V , class T = std::decay_t<V>>
using Cyto::IsAnyConstructible_ = std::bool_constant<!std::is_same_v< T, Any > &&!IsInPlaceType< V > &&std::is_copy_constructible_v< T > >
 
template<class T , class U , class... Args>
using Cyto::IsAnyInitializerListConstructible_ = std::bool_constant< std::is_constructible_v< T, std::initializer_list< U > &, Args... > &&std::is_copy_constructible_v< T > >
 

Functions

template<class T >
ANY_ALWAYS_INLINE constexpr void const * Cyto::fallback_typeid ()
 
ANY_ALWAYS_INLINE void Cyto::swap (Any &lhs, Any &rhs) noexcept
 
template<class T , class... Args>
ANY_ALWAYS_INLINE Any Cyto::make_any (Args &&... args)
 
template<class T , class U , class... Args>
ANY_ALWAYS_INLINE Any Cyto::make_any (std::initializer_list< U > il, Args &&... args)
 
template<class V , class T = std::remove_cv_t<std::remove_reference_t<V>>, std::enable_if_t< std::is_constructible< V, T const & >{}, int > = 0>
Cyto::any_cast (Any const &a)
 
template<class V , class T = std::remove_cv_t<std::remove_reference_t<V>>, std::enable_if_t< std::is_constructible< V, T const & >{}, int > = 0>
Cyto::any_cast (Any &a)
 
template<class V , class T = std::remove_cv_t<std::remove_reference_t<V>>, std::enable_if_t< std::is_constructible< V, T const & >{}, int > = 0>
Cyto::any_cast (Any &&a)
 
template<class V , class T = std::remove_cv_t<std::remove_reference_t<V>>>
T const * Cyto::any_cast (Any const *a) noexcept
 
template<class V >
std::remove_cv_t< std::remove_reference_t< V > > * Cyto::any_cast (Any *a) noexcept
 

Variables

template<class T >
constexpr bool Cyto::IsInPlaceType = IsInPlaceType_<T>::value
 
constexpr size_t Cyto::StorageBufferSize = 8 * sizeof(void*)
 
template<class T >
constexpr bool Cyto::IsStorageBufferSized = IsStorageBufferSized_<T>::value
 
template<class V >
constexpr bool Cyto::IsAnyConstructible = IsAnyConstructible_<V>::value
 
template<class T , class U , class... Args>
constexpr bool Cyto::IsAnyInitializerListConstructible = IsAnyInitializerListConstructible_<T, U, Args...>::value
 

Macro Definition Documentation

◆ ANY_ALWAYS_INLINE

#define ANY_ALWAYS_INLINE   inline

Definition at line 49 of file cyto_any.hpp.

◆ ANY_USE

#define ANY_USE (   FEATURE)    (defined ANY_USE_##FEATURE && ANY_USE_##FEATURE)

Definition at line 78 of file cyto_any.hpp.

◆ ANY_USE_EXCEPTIONS

#define ANY_USE_EXCEPTIONS   0

Definition at line 71 of file cyto_any.hpp.

◆ ANY_USE_SMALL_MEMCPY_STRATEGY

#define ANY_USE_SMALL_MEMCPY_STRATEGY   1

Definition at line 75 of file cyto_any.hpp.

◆ ANY_USE_TYPEINFO

#define ANY_USE_TYPEINFO   0

Definition at line 65 of file cyto_any.hpp.