|
| OFvariant () |
| Constructs a variant holding a default constructed value of the first alternative.
|
|
| OFvariant (const OFvariant &rhs) |
| Copy constructs a variant holding a copy of the value rhs holds.
|
|
| OFvariant (OFvariant &&rhs) |
| Move constructs a variant by moving the value rhs holds.
|
|
template<typename T > |
| OFvariant (T t) |
| Constructs a variant holding the alternative that most closely matches the given argument.
|
|
| ~OFvariant () |
| Destroys the value that the variant currently holds.
|
|
OFvariant & | operator= (const OFvariant &rhs) |
| Copy assigns the value rhs holds to *this.
|
|
OFvariant & | operator= (OFvariant &&rhs) |
| Move assigns the value rhs holds to *this.
|
|
template<typename T > |
OFvariant & | operator= (T t) |
| Converts the given argument to one of the alternatives and assigns it to *this.
|
|
size_t | index () const |
| Get the index of alternative that is currently being held.
|
|
|
Global types, methods and objects that are somehow related
|
template<typename Alternative , typename... Alternatives> |
Alternative * | OFget (OFvariant< Alternatives... > *v) |
| Try to get a pointer to the given alternative from an OFvariant object.
|
|
template<typename Alternative , typename... Alternatives> |
const Alternative * | OFget (const OFvariant< Alternatives... > *v) |
| Try to get a pointer to the given alternative from an OFvariant object.
|
|
template<typename Result , typename Visitor , typename... Alternatives> |
Result | OFvisit (Visitor visitor, OFvariant< Alternatives... > &v) |
| Applies the given visitor to the given OFvariant object.
|
|
template<typename Result , typename Visitor , typename... Alternatives> |
Result | OFvisit (Visitor visitor, const OFvariant< Alternatives... > &v) |
| Applies the given visitor to the given OFvariant object.
|
|
template<typename... Alternatives>
class OFvariant< Alternatives >
A class template that represents a type-safe union.
#include "dcmtk/ofstd/ofvriant.h" for using this class
- Template Parameters
-
Alternatives | a set of types that may be stored in this variant. All types must be (possibly cv-qualified) object types. |
OFvariant is a custom implementation of a subset of C++17's std::variant, see http://en.cppreference.com/w/cpp/utility/variant for a description of std::variant. An instance of OFvariant at any given time holds a value of one of its alternative types. As with unions, if a variant holds a value of some object type T, the object representation of T is allocated directly within the object representation of the variant itself if possible.
- Note
- If no suitable alignment specifiers were available for the target platform, OFvariant will use a fallback implementation that stores the alternative on the heap – as opposite to std::variant.
The preferred way to access an OFvariant object is visitation utilizing OFvisit. If a certain alternative is expected to be held by the variant, OFget may be used to access it directly.
- See also
- OFvisit – Apply a visitor to an OFvariant object.
-
OFget – Get a pointer to the value stored in an OFvariant holding the selected alternative.
-
OFmonostate – A helper type for making OFvariant default constructible.
-
OFin_place –
Tools for in-place construction of objects, e.g. certain OFvariant alternatives.