|
constexpr | unsafe_any_t ()=default |
|
template<typename T , typename = std::enable_if_t<use_internal_storage<T> && !std::is_same_v<std::decay_t<T>, unsafe_any_t>>> |
| unsafe_any_t (T &&value) noexcept |
|
template<typename T , typename Allocator = config::allocator<std::decay_t<T>>, typename = std::enable_if_t<!use_internal_storage<T> && !std::is_same_v<std::decay_t<T>, unsafe_any_t>>> |
| unsafe_any_t (T &&value, Allocator alloc=Allocator{}) |
|
| unsafe_any_t (unsafe_any_t &&other) noexcept |
|
| unsafe_any_t (const unsafe_any_t &other) |
|
unsafe_any_t & | operator= (unsafe_any_t other) noexcept |
|
| ~unsafe_any_t () noexcept |
|
bool | has_value () const noexcept |
|
template<typename T , typename DecayType = std::decay_t<T>> |
std::decay_t< T > & | get () noexcept |
|
template<typename T > |
auto | get () const noexcept -> std::conditional_t<(sizeof(T)<=sizeof(std::size_t)) &&std::is_copy_constructible_v< T >, std::decay_t< T >, const std::decay_t< T > & > |
|
template<std::size_t SmallObjectOptimisationSize = sizeof(std::size_t)>
class arg_router::utility::unsafe_any_t< SmallObjectOptimisationSize >
Type erasure type similar to std::any
but has no type checking safety features.
- Template Parameters
-
SmallObjectOptimisationSize | Size in bytes of the small object optimisation limit. Holding objects larger will incur heap allocation. Defaults to word size |
Definition at line 21 of file unsafe_any.hpp.
template<std::size_t SmallObjectOptimisationSize = sizeof(std::size_t)>
template<typename T , typename = std::enable_if_t<use_internal_storage<T> && !std::is_same_v<std::decay_t<T>, unsafe_any_t>>>
Constructs an unsafe_any_t from value.
This constructor only takes part in overload resolution if T fits inside the internal storage.
- Template Parameters
-
- Parameters
-
value | Value to initialise from, will move construct if an rvalue is passed in |
Definition at line 47 of file unsafe_any.hpp.
template<std::size_t SmallObjectOptimisationSize = sizeof(std::size_t)>
template<typename T , typename Allocator = config::allocator<std::decay_t<T>>, typename = std::enable_if_t<!use_internal_storage<T> && !std::is_same_v<std::decay_t<T>, unsafe_any_t>>>
Constructs an unsafe_any_t from value.
This constructor only takes part in overload resolution if T does not fit inside the internal storage.
- Template Parameters
-
T | Type to construct from |
Allocator | Allocator type, only used when not using internal storage |
- Parameters
-
value | Value to initialise from, will move construct if an rvalue is passed in |
alloc | Allocator instance |
Definition at line 77 of file unsafe_any.hpp.
template<std::size_t SmallObjectOptimisationSize = sizeof(std::size_t)>
template<typename T , typename DecayType = std::decay_t<T>>
Returns a reference to the held object.
Undefined behaviour if T is not the held type.
- Template Parameters
-
- Returns
- Held object
Definition at line 148 of file unsafe_any.hpp.