24 #include <type_traits> 38 template <
class T_DTYPES,
typename...
T>
42 std::is_enum<T_DTYPES>::value,
43 "Datatypes to Variant must be supplied as enum.");
46 using resource = std::variant<
T...>;
54 Variant(resource r) : dtype{
static_cast<T_DTYPES
>(r.index())}, m_data{r}
67 return std::get<U>(m_data);
83 constexpr
size_t index() const noexcept
85 return m_data.index();
Variant(resource r)
Construct a lightweight wrapper around a generic object that indicates the concrete datatype of the s...
Definition: Variant.hpp:54
Generic object to store a set of datatypes in without losing type safety.
Definition: Variant.hpp:39
constexpr size_t index() const noexcept
Retrieve the index of the alternative that is currently been held.
Definition: Variant.hpp:83
Public definitions of openPMD-api.
resource getResource() const
Retrieve the stored generic object.
Definition: Variant.hpp:74