openPMD-api
Public Member Functions | List of all members
openPMD::auxiliary::Option< T > Class Template Reference

Simple Option type based on variantSrc::variant. More...

#include <Option.hpp>

Public Member Functions

 Option ()
 Create an empty Option.
 
 Option (T data)
 Create a full Option. More...
 
 Option (Option const &other)=default
 
Optionoperator= (Option &&other)
 
Optionoperator= (Option const &other)
 
bool operator== (Option const &other) const
 
bool operator!= (Option const &other) const
 
bool has_value () const
 
 operator bool () const
 
const T & get () const
 Access the emplaced object if one is present. More...
 
T & get ()
 Access the emplaced object if one is present. More...
 

Detailed Description

template<typename T>
class openPMD::auxiliary::Option< T >

Simple Option type based on variantSrc::variant.

Template Parameters
TType that can be optionally stored in an Optional object.

Constructor & Destructor Documentation

◆ Option()

template<typename T >
openPMD::auxiliary::Option< T >::Option ( data)
inline

Create a full Option.

Parameters
dataThe object to emplace in the Option.

Member Function Documentation

◆ get() [1/2]

template<typename T >
T& openPMD::auxiliary::Option< T >::get ( )
inline

Access the emplaced object if one is present.

Exceptions
std::bad_variant_accessif no object is present.
Returns
The emplaced object.

◆ get() [2/2]

template<typename T >
const T& openPMD::auxiliary::Option< T >::get ( ) const
inline

Access the emplaced object if one is present.

Exceptions
std::bad_variant_accessif no object is present.
Returns
The emplaced object.

◆ has_value()

template<typename T >
bool openPMD::auxiliary::Option< T >::has_value ( ) const
inline
Returns
Is an object constantly stored in this?

◆ operator bool()

template<typename T >
openPMD::auxiliary::Option< T >::operator bool ( ) const
inline
Returns
Is an object constantly stored in this?

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