DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Classes
ofvriant.h File Reference

Declares OFvariant and related functionality. More...

## Classes
class | OFvariant< Alternatives >
| A class template that represents a type-safe union. More...
struct | OFmonostate
| A helper type for making OFvariant default constructible. More...

## Detailed Description

Declares OFvariant and related functionality.

## Class Documentation

## ◆ OFmonostate

struct OFmonostate

A helper type for making OFvariant default constructible.

Use OFmonostate as the first alternative of an OFvariant otherwise holding a non default constructible type as the first alternative for making the variant itself default constructible.

Note
  Be aware that any visitor applied to such an OFvariant object must also accept OFmonostate as an argument.

### Example

template<typename T>
struct NonDefaultConstructible
{
NonDefaultConstructible( T t ) : value( t ) {}
T value;
};
typedef NonDefaultConstructible<int> nint;
typedef NonDefaultConstructible<float> nfloat;
// ...
OFvariant<nint,nfloat> v( 3 ); // OK, but what if we don't know the value yet?
OFvariant<nint,nfloat> v; // ERROR!
OFvariant<OFmonostate,nint,nfloat> v; // OK
v = 3; // assign the value when it's known
OFvariant
A class template that represents a type-safe union.
Definition: ofvriant.h:417

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1