VTK-m
2.0
|
#include <VariantImpl.h>
Public Types | |
template<typename T > | |
using | IndexOf = vtkm::ListIndexOf< vtkm::List< Ts... >, T > |
Type that converts to a std::integral_constant containing the index of the given type (or -1 if that type is not in the list). More... | |
template<vtkm::IdComponent Index> | |
using | TypeAt = typename vtkm::ListAt< vtkm::List< Ts... >, Index > |
Type that converts to the type at the given index. More... | |
template<typename T > | |
using | CanStore = std::integral_constant< bool,(IndexOf< T >::value >=0)> |
Type that indicates whether another type can be stored in this Variant. More... | |
Public Member Functions | |
VTK_M_DEVICE vtkm::IdComponent | GetIndex () const noexcept |
Returns the index of the type of object this variant is storing. More... | |
VTK_M_DEVICE bool | IsValid () const noexcept |
Returns true if this Variant is storing an object from one of the types in the template list, false otherwise. More... | |
template<typename T > | |
VTK_M_DEVICE bool | IsType () const |
Returns true if this Variant stores the given type. More... | |
Variant ()=default | |
~Variant ()=default | |
Variant (const Variant &)=default | |
Variant (Variant &&)=default | |
Variant & | operator= (const Variant &)=default |
Variant & | operator= (Variant &&)=default |
template<typename T > | |
VTK_M_DEVICE | Variant (const T &src) noexcept |
template<typename T > | |
VTK_M_DEVICE Variant & | operator= (const T &src) |
template<typename T , typename... Args> | |
VTK_M_DEVICE T & | Emplace (Args &&... args) |
template<typename T , typename U , typename... Args> | |
VTK_M_DEVICE T & | Emplace (std::initializer_list< U > il, Args &&... args) |
template<vtkm::IdComponent I, typename... Args> | |
VTK_M_DEVICE TypeAt< I > & | Emplace (Args &&... args) |
template<vtkm::IdComponent I, typename U , typename... Args> | |
VTK_M_DEVICE TypeAt< I > & | Emplace (std::initializer_list< U > il, Args &&... args) |
template<vtkm::IdComponent I> | |
VTK_M_DEVICE TypeAt< I > & | Get () noexcept |
template<vtkm::IdComponent I> | |
const VTK_M_DEVICE TypeAt< I > & | Get () const noexcept |
template<typename T > | |
VTK_M_DEVICE T & | Get () noexcept |
template<typename T > | |
const VTK_M_DEVICE T & | Get () const noexcept |
template<typename Functor , typename... Args> | |
VTK_M_DEVICE auto | CastAndCall (Functor &&f, Args &&... args) const noexcept(noexcept(f(std::declval< const TypeAt< 0 > & >(), args...))) |
template<typename Functor , typename... Args> | |
VTK_M_DEVICE auto | CastAndCall (Functor &&f, Args &&... args) noexcept(noexcept(f(std::declval< TypeAt< 0 > & >(), args...))) |
VTK_M_DEVICE void | Reset () noexcept |
Destroys any object the Variant is holding and sets the Variant to an invalid state. More... | |
Static Public Member Functions | |
template<typename T > | |
static constexpr VTK_M_DEVICE vtkm::IdComponent | GetIndexOf () |
Returns the index for the given type (or -1 if that type is not in the list). More... | |
template<typename T > | |
static constexpr VTK_M_DEVICE bool | GetCanStore () |
Returns whether the given type can be respresented in this Variant. More... | |
Static Public Attributes | |
static constexpr vtkm::IdComponent | NumberOfTypes = vtkm::IdComponent{ sizeof...(Ts) } |
The number of types representable by this Variant. More... | |
Private Types | |
using | Superclass = detail::VariantConstructorImpl< Variant< Ts... > > |
using | CheckTypes = vtkm::List< detail::VariantCheckType< Ts >... > |
Private Member Functions | |
template<typename T , vtkm::IdComponent I, typename... Args> | |
VTK_M_DEVICE T & | EmplaceImpl (Args &&... args) |
template<typename T , vtkm::IdComponent I, typename U , typename... Args> | |
VTK_M_DEVICE T & | EmplaceImpl (std::initializer_list< U > il, Args &&... args) |
template<typename T > | |
VTK_M_DEVICE T & | GetImpl (std::true_type) |
template<typename T > | |
const VTK_M_DEVICE T & | GetImpl (std::true_type) const |
template<typename T > | |
VTK_M_DEVICE T & | GetImpl (std::false_type) const |
using vtkm::VTK_M_NAMESPACE::Variant< Ts >::CanStore = std::integral_constant<bool, (IndexOf<T>::value >= 0)> |
|
private |
using vtkm::VTK_M_NAMESPACE::Variant< Ts >::IndexOf = vtkm::ListIndexOf<vtkm::List<Ts...>, T> |
Type that converts to a std::integral_constant containing the index of the given type (or -1 if that type is not in the list).
|
private |
using vtkm::VTK_M_NAMESPACE::Variant< Ts >::TypeAt = typename vtkm::ListAt<vtkm::List<Ts...>, Index> |
Type that converts to the type at the given index.
|
default |
|
default |
|
default |
|
default |
|
inlinenoexcept |
|
inlinenoexcept |
Given a functor object, calls the functor with the contained object cast to the appropriate type. If extra args
are given, then those are also passed to the functor after the cast object. If the functor returns a value, that value is returned from CastAndCall
.
The results are undefined if the Variant is not valid.
|
inlinenoexcept |
Given a functor object, calls the functor with the contained object cast to the appropriate type. If extra args
are given, then those are also passed to the functor after the cast object. If the functor returns a value, that value is returned from CastAndCall
.
The results are undefined if the Variant is not valid.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlinenoexcept |
Returns the value as the type at the given index. The behavior is undefined if the variant does not contain the value at the given index.
|
inlinenoexcept |
Returns the value as the given type. The behavior is undefined if the variant does not contain a value of the given type.
|
inlinenoexcept |
Returns the value as the type at the given index. The behavior is undefined if the variant does not contain the value at the given index.
|
inlinenoexcept |
Returns the value as the given type. The behavior is undefined if the variant does not contain a value of the given type.
|
inlinestaticconstexpr |
Returns whether the given type can be respresented in this Variant.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlinenoexcept |
Returns the index of the type of object this variant is storing.
If no object is currently stored (i.e. the Variant
is invalid), an invalid is returned.
|
inlinestaticconstexpr |
Returns the index for the given type (or -1 if that type is not in the list).
|
inline |
Returns true if this Variant
stores the given type.
|
inlinenoexcept |
Returns true if this Variant
is storing an object from one of the types in the template list, false otherwise.
Note that if this Variant
was not initialized with an object, the result of IsValid
is undefined. The Variant
could report itself as validly containing an object that is trivially constructed.
|
inline |
|
default |
|
default |
|
inlinenoexcept |
|
staticconstexpr |
The number of types representable by this Variant.