HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::TypeList< Ts > Struct Template Reference

A list of types (not necessarily unique) More...

#include <Types.h>

Public Types

using Self = TypeList
 The type of this list. More...
 
template<size_t N>
using Get = typename internal::TSGetElementImpl< Self, N >::type
 Access a particular element of this type list. If the index is out of range, internal::NullType is returned. More...
 
using Front = Get< 0 >
 
using Back = Get< Size-1 >
 
using Unique = typename internal::TSMakeUniqueImpl< TypeList<>, Ts...>::type
 Remove any duplicate types from this TypeList by rotating the next valid type left (maintains the order of other types). More...
 
template<typename... TypesToAppend>
using Append = typename internal::TSAppendImpl< Self, TypesToAppend...>::type
 Append types, or the members of another TypeList, to this list. More...
 
template<typename... TypesToRemove>
using Remove = typename internal::TSRemoveImpl< Self, TypesToRemove...>::type
 Remove all occurrences of one or more types, or the members of another TypeList, from this list. More...
 
using PopFront = typename internal::TSRemoveFirstImpl< Self >::type
 Remove the first element of this type list. Has no effect if the type list is already empty. More...
 
using PopBack = typename internal::TSRemoveLastImpl< Self >::type
 Remove the last element of this type list. Has no effect if the type list is already empty. More...
 
template<size_t First, size_t Last>
using RemoveByIndex = typename internal::TSRemoveIndicesImpl< Self, First, Last >::type
 Return a new list with types removed by their location within the list. If First is equal to Last, a single element is removed (if it exists). If First is greater than Last, the list remains unmodified. More...
 

Static Public Member Functions

template<typename OpT >
static void foreach (OpT op)
 Invoke a templated, unary functor on a value of each type in this list. More...
 

Static Public Attributes

static constexpr size_t Size = sizeof...(Ts)
 The number of types in the type list. More...
 
template<typename T >
static constexpr bool Contains = internal::TSHasTypeImpl<Self, T>::Value
 True if this list contains the given type, false otherwise. More...
 
template<typename T >
static constexpr int64_t Index = internal::TSHasTypeImpl<Self, T>::Index
 Returns the index of the first found element of the given type, -1 if no matching element exists. More...
 

Detailed Description

template<typename... Ts>
struct openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >

A list of types (not necessarily unique)

Example:

using MyTypes = openvdb::TypeList<int, float, int, double, float>;

Definition at line 652 of file Types.h.

Member Typedef Documentation

template<typename... Ts>
template<typename... TypesToAppend>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Append = typename internal::TSAppendImpl<Self, TypesToAppend...>::type

Append types, or the members of another TypeList, to this list.

Example:

{
using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
using RealTypes = openvdb::TypeList<float, double>;
using NumericTypes = IntTypes::Append<RealTypes>;
}
{
using IntTypes = openvdb::TypeList<Int16>::Append<Int32, Int64>;
using NumericTypes = IntTypes::Append<float>::Append<double>;
}

Definition at line 725 of file Types.h.

template<typename... Ts>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Back = Get<Size-1>

Definition at line 665 of file Types.h.

template<typename... Ts>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Front = Get<0>

Definition at line 664 of file Types.h.

template<typename... Ts>
template<size_t N>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Get = typename internal::TSGetElementImpl<Self, N>::type

Access a particular element of this type list. If the index is out of range, internal::NullType is returned.

Definition at line 663 of file Types.h.

template<typename... Ts>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::PopBack = typename internal::TSRemoveLastImpl<Self>::type

Remove the last element of this type list. Has no effect if the type list is already empty.

Example:

{
using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
using EmptyTypes = openvdb::TypeList<>;
}
{
IntTypes::PopBack; // openvdb::TypeList<Int16, Int32>;
EmptyTypes::PopBack; // openvdb::TypeList<>;
}

Definition at line 768 of file Types.h.

template<typename... Ts>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::PopFront = typename internal::TSRemoveFirstImpl<Self>::type

Remove the first element of this type list. Has no effect if the type list is already empty.

Example:

{
using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
using EmptyTypes = openvdb::TypeList<>;
}
{
IntTypes::PopFront; // openvdb::TypeList<Int32, Int64>;
EmptyTypes::PopFront; // openvdb::TypeList<>;
}

Definition at line 753 of file Types.h.

template<typename... Ts>
template<typename... TypesToRemove>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Remove = typename internal::TSRemoveImpl<Self, TypesToRemove...>::type

Remove all occurrences of one or more types, or the members of another TypeList, from this list.

Example:

{
using NumericTypes = openvdb::TypeList<float, double, Int16, Int32, Int64>;
using LongTypes = openvdb::TypeList<Int64, double>;
using ShortTypes = NumericTypes::Remove<LongTypes>; // float, Int16, Int32
}

Definition at line 738 of file Types.h.

template<typename... Ts>
template<size_t First, size_t Last>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::RemoveByIndex = typename internal::TSRemoveIndicesImpl<Self, First, Last>::type

Return a new list with types removed by their location within the list. If First is equal to Last, a single element is removed (if it exists). If First is greater than Last, the list remains unmodified.

Example:

{
using NumericTypes = openvdb::TypeList<float, double, Int16, Int32, Int64>;
}
{
using IntTypes = NumericTypes::RemoveByIndex<0,1>; // openvdb::TypeList<Int16, Int32, Int64>;
using RealTypes = NumericTypes::RemoveByIndex<2,4>; // openvdb::TypeList<float, double>;
using RemoveFloat = NumericTypes::RemoveByIndex<0,0>; // openvdb::TypeList<double, Int16, Int32, Int64>;
}

Definition at line 785 of file Types.h.

template<typename... Ts>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Self = TypeList

The type of this list.

Definition at line 655 of file Types.h.

template<typename... Ts>
using openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Unique = typename internal::TSMakeUniqueImpl<TypeList<>, Ts...>::type

Remove any duplicate types from this TypeList by rotating the next valid type left (maintains the order of other types).

Example:

{
using Types = openvdb::TypeList<Int16, Int32, Int16, float, float, Int64>;
}
{
using UniqueTypes = Types::Unique; // <Int16, Int32, float, Int64>
}

Definition at line 709 of file Types.h.

Member Function Documentation

template<typename... Ts>
template<typename OpT >
static void openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::foreach ( OpT  op)
inlinestatic

Invoke a templated, unary functor on a value of each type in this list.

Example:

#include <typeinfo>
template<typename ListT>
void printTypeList()
{
auto op = [&](auto x) { // C++14
std::cout << sep << typeid(decltype(x)).name(); sep = ", "; };
}
using MyTypes = openvdb::TypeList<int, float, double>;
printTypeList<MyTypes>(); // "i, f, d" (exact output is compiler-dependent)
Note
The functor object is passed by value. Wrap it with std::ref to use the same object for each type.

Definition at line 808 of file Types.h.

Member Data Documentation

template<typename... Ts>
template<typename T >
constexpr bool openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Contains = internal::TSHasTypeImpl<Self, T>::Value
static

True if this list contains the given type, false otherwise.

Example:

{
using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
using RealTypes = openvdb::TypeList<float, double>;
}
{
openvdb::TypeList<IntTypes>::Contains<Int32>; // true
openvdb::TypeList<RealTypes>::Contains<Int32>; // false
}

Definition at line 680 of file Types.h.

template<typename... Ts>
template<typename T >
constexpr int64_t openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Index = internal::TSHasTypeImpl<Self, T>::Index
static

Returns the index of the first found element of the given type, -1 if no matching element exists.

Example:

{
using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
using RealTypes = openvdb::TypeList<float, double>;
}
{
const int64_t L1 = openvdb::TypeList<IntTypes>::Index<Int32>; // 1
const int64_t L2 = openvdb::TypeList<RealTypes>::Index<Int32>; // -1
}

Definition at line 696 of file Types.h.

template<typename... Ts>
constexpr size_t openvdb::OPENVDB_VERSION_NAME::TypeList< Ts >::Size = sizeof...(Ts)
static

The number of types in the type list.

Definition at line 658 of file Types.h.


The documentation for this struct was generated from the following file: