|
Blender V4.5
|
#include <BLI_any.hh>
Public Member Functions | |
| Any ()=default | |
| Any (const Any &other) | |
| Any (Any &&other) noexcept | |
| template<typename T , typename... Args> | |
| Any (std::in_place_type_t< T >, Args &&...args) | |
| template<typename T , BLI_ENABLE_IF((!is_same_any_v< T >)) > | |
| Any (T &&value) | |
| ~Any () | |
| Any & | operator= (const Any &other) |
| template<typename T > | |
| Any & | operator= (T &&other) |
| void | reset () |
| operator bool () const | |
| bool | has_value () const |
| template<typename T , typename... Args> | |
| std::decay_t< T > & | emplace (Args &&...args) |
| template<typename T , typename... Args> | |
| std::decay_t< T > & | emplace_on_empty (Args &&...args) |
| template<typename T > | |
| void * | allocate () |
| template<typename T > | |
| void * | allocate_on_empty () |
| template<typename T > | |
| bool | is () const |
| void * | get () |
| const void * | get () const |
| template<typename T > | |
| T & | get () |
| template<typename T > | |
| const T & | get () const |
| const RealExtraInfo & | extra_info () const |
Static Public Attributes | |
| template<typename T > | |
| static constexpr bool | is_allowed_v = std::is_copy_constructible_v<T> |
| template<typename T > | |
| static constexpr bool | is_inline_v |
| template<typename T > | |
| static constexpr bool | is_same_any_v = std::is_same_v<std::decay_t<T>, Any> |
Definition at line 98 of file BLI_any.hh.
|
default |
|
inline |
Definition at line 153 of file BLI_any.hh.
References blender::detail::AnyTypeInfo< ExtraInfo >::copy_construct, and blender::AlignedBuffer< Size, Alignment >::ptr().
|
inlinenoexcept |
Definition at line 171 of file BLI_any.hh.
References blender::detail::AnyTypeInfo< ExtraInfo >::move_construct, and blender::AlignedBuffer< Size, Alignment >::ptr().
|
inlineexplicit |
Constructs a new Any that contains the given type T from #args. The #std::in_place_type_t is used to disambiguate this and the copy/move constructors.
Definition at line 189 of file BLI_any.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::emplace_on_empty().
|
inline |
Constructs a new Any that contains the given value.
Definition at line 198 of file BLI_any.hh.
|
inline |
Definition at line 202 of file BLI_any.hh.
References blender::detail::AnyTypeInfo< ExtraInfo >::destruct.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::emplace(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::operator=(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::operator=().
|
inline |
Like emplace but does not actually construct the value. The caller is responsible for calling the constructor before the value is used.
Definition at line 289 of file BLI_any.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::allocate_on_empty(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::reset().
Referenced by blender::bke::SocketValueVariant::allocate_single(), and blender::tests::TEST().
|
inline |
Like emplace_on_empty but does not actually construct the value. The caller is responsible for calling the constructor before the value is used.
Definition at line 299 of file BLI_any.hh.
References BLI_assert, blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::has_value(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::is_allowed_v, blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::is_inline_v, blender::AlignedBuffer< Size, Alignment >::ptr(), T, and value.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::allocate().
|
inline |
Definition at line 258 of file BLI_any.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::Any(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::get(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::~Any().
Referenced by blender::bke::SocketValueVariant::store_single().
|
inline |
Definition at line 265 of file BLI_any.hh.
References BLI_assert, blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::has_value(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::is_allowed_v, and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::is_inline_v.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::Any().
|
inline |
Get extra information that has been stored for the contained type.
Definition at line 373 of file BLI_any.hh.
References BLI_assert, and blender::detail::AnyTypeInfo< ExtraInfo >::extra_info.
Referenced by blender::GVArrayCommon::impl_from_storage(), and blender::VArrayCommon< T >::impl_from_storage().
|
inline |
Get a pointer to the stored value.
Definition at line 322 of file BLI_any.hh.
References BLI_assert, and blender::detail::AnyTypeInfo< ExtraInfo >::get.
Referenced by blender::bke::SocketValueVariant::convert_to_single(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::emplace(), blender::bke::SocketValueVariant::extract(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::get(), blender::bke::SocketValueVariant::get_single_ptr(), blender::bke::SocketValueVariant::get_single_ptr_raw(), blender::GVArrayCommon::impl_from_storage(), blender::VArrayCommon< T >::impl_from_storage(), blender::bke::SocketValueVariant::is_context_dependent_field(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().
|
inline |
Get a reference to the stored value. This invokes undefined behavior when T does not have the correct type.
Definition at line 345 of file BLI_any.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::get().
|
inline |
Get a pointer to the stored value.
Definition at line 332 of file BLI_any.hh.
References BLI_assert, and blender::detail::AnyTypeInfo< ExtraInfo >::get.
|
inline |
Get a reference to the stored value. This invokes undefined behavior when T does not have the correct type.
Definition at line 355 of file BLI_any.hh.
References BLI_assert, blender::detail::AnyTypeInfo< ExtraInfo >::get, blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::is(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::is_inline_v.
|
inline |
Definition at line 253 of file BLI_any.hh.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::allocate_on_empty(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::emplace_on_empty(), blender::GVArrayCommon::impl_from_storage(), blender::VArrayCommon< T >::impl_from_storage(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::operator bool(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().
|
inline |
Return true when the value that is currently stored is a T.
Definition at line 316 of file BLI_any.hh.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::get(), blender::bke::SocketValueVariant::is_context_dependent_field(), blender::tests::TEST(), and blender::tests::TEST().
|
inline |
Definition at line 248 of file BLI_any.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::has_value().
|
inline |
Definition at line 214 of file BLI_any.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::Any(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::~Any().
|
inline |
Assign any value to the Any.
Definition at line 225 of file BLI_any.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::Any(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::is_same_any_v, and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::~Any().
|
inline |
Destruct any existing value to make it empty.
Definition at line 238 of file BLI_any.hh.
References blender::detail::AnyTypeInfo< ExtraInfo >::destruct.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::allocate(), and blender::tests::TEST().
|
staticconstexpr |
Only copy constructible types can be stored in Any.
Definition at line 121 of file BLI_any.hh.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::allocate_on_empty(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::emplace_on_empty().
|
staticconstexpr |
Checks if the type will be stored in the inline buffer or if it requires a separate allocation.
Definition at line 128 of file BLI_any.hh.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::allocate_on_empty(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::emplace_on_empty(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::get().
|
staticconstexpr |
Checks if T is the same type as this Any, because in this case the behavior of e.g. the assignment operator is different.
Definition at line 135 of file BLI_any.hh.
Referenced by blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::operator=().