VTK-m
2.2
|
#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 | |
vtkm::IdComponent | GetIndex () const noexcept |
Returns the index of the type of object this variant is storing. More... | |
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 > | |
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 > | |
Variant (const T &src) noexcept | |
template<typename T > | |
Variant & | operator= (const T &src) |
template<typename T , typename... Args> | |
T & | Emplace (Args &&... args) |
template<typename T , typename U , typename... Args> | |
T & | Emplace (std::initializer_list< U > il, Args &&... args) |
template<vtkm::IdComponent I, typename... Args> | |
TypeAt< I > & | Emplace (Args &&... args) |
template<vtkm::IdComponent I, typename U , typename... Args> | |
TypeAt< I > & | Emplace (std::initializer_list< U > il, Args &&... args) |
template<vtkm::IdComponent I> | |
TypeAt< I > & | Get () noexcept |
template<vtkm::IdComponent I> | |
const TypeAt< I > & | Get () const noexcept |
template<typename T > | |
T & | Get () noexcept |
template<typename T > | |
const T & | Get () const noexcept |
template<typename Functor , typename... Args> | |
auto | CastAndCall (Functor &&f, Args &&... args) const noexcept(noexcept(f(std::declval< const TypeAt< 0 > & >(), args...))) |
template<typename Functor , typename... Args> | |
auto | CastAndCall (Functor &&f, Args &&... args) noexcept(noexcept(f(std::declval< TypeAt< 0 > & >(), args...))) |
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 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 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> | |
T & | EmplaceImpl (Args &&... args) |
template<typename T , vtkm::IdComponent I, typename U , typename... Args> | |
T & | EmplaceImpl (std::initializer_list< U > il, Args &&... args) |
template<typename T > | |
T & | GetImpl (std::true_type) |
template<typename T > | |
const T & | GetImpl (std::true_type) const |
template<typename T > | |
T & | GetImpl (std::false_type) const |
using vtkm::tmp::Variant< Ts >::CanStore = std::integral_constant<bool, (IndexOf<T>::value >= 0)> |
|
private |
using vtkm::tmp::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::tmp::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.
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.