DCMTK: OFdefault_optional_traits< T > Class Template Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
OFdefault_optional_traits< T > Class Template Reference

Default storage traits of OFoptional<T>. More...

## Detailed Description

template<typename T>
class OFdefault_optional_traits< T >

Default storage traits of OFoptional<T>.

OFdefault_optional_traits manages the state and storage of the contained object in a portable manner. You may use this class as base when defining custom traits for a specific type T, so you won't have to re-implement this functionality entirely.

Template Parameters

  T | the content type of the respective OFoptional instance.

See also
  OFoptional
  OFoptional_traits

## Example

This example shows how to override the is_default_constructible attribute of `OFoptional_traits` for the custom class Test.

// Note: Test's default constructor is private
// which leads to errors when being used within
// OFoptional, since a default constructor exists
// but can't be accessed.
class Test
{
Test() {}
public:
static OFoptional<T> instance();
.
.
.
};
// Override OFoptional's behavior to fix this problem
template<>
struct OFoptional_traits<Test>
: OFdefault_optional_traits<Test> // derived from default traits
{
// Tell OFoptional that it can't default-construct
// a Test object.
typedef OFfalse_type is_default_constructible;
};
OFoptional
The class template OFoptional manages an optional contained value, i.e. a value tagged with a state t...
Definition ofoption.h:486

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

- ofstd/include/dcmtk/ofstd/ofoption.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1