24 #include <type_traits>
38 template <
class T_DTYPES,
typename std_variant>
42 std::is_enum<T_DTYPES>::value,
43 "Datatypes to Variant must be supplied as enum.");
46 using resource = std_variant;
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();
98 template <
class... Ts>
101 using Ts::operator()...;
103 template <
class... Ts>
Generic object to store a set of datatypes in without losing type safety.
Definition: Variant.hpp:40
constexpr size_t index() const noexcept
Retrieve the index of the alternative that is currently been held.
Definition: Variant.hpp:83
U get() const
Retrieve a stored specific object of known datatype with ensured type-safety.
Definition: Variant.hpp:65
Variant(resource r)
Construct a lightweight wrapper around a generic object that indicates the concrete datatype of the s...
Definition: Variant.hpp:54
resource getResource() const
Retrieve the stored generic object.
Definition: Variant.hpp:74
Public definitions of openPMD-api.
Definition: Date.cpp:29
Definition: Variant.hpp:100