A library for working with phylogenetic and population genetic data.
v0.32.0
Optional< T > Class Template Reference

#include <genesis/utils/containers/optional.hpp>

Detailed Description

template<typename T>
class genesis::utils::Optional< T >

Simplistic optional: requires T to be default constructible, copyable.

The implementation is based on https://github.com/martinmoene/optional-bare, which is published under the Boost Software License - Version 1.0, see our Acknowledgements for further details.

Definition at line 178 of file optional.hpp.

Public Member Functions

 Optional ()
 
 Optional (nullopt_t)
 
template<class U >
 Optional (Optional< U > &&other)
 
template<class U >
 Optional (Optional< U > const &other)
 
 Optional (T &&arg)
 
 Optional (T const &arg)
 
bool has_value () const
 
 operator bool () const
 
value_typeoperator* ()
 
const value_typeoperator* () const
 
value_typeoperator-> ()
 
const value_typeoperator-> () const
 
Optionaloperator= (nullopt_t)
 
template<class U >
Optionaloperator= (Optional< U > &&other)
 
template<class U >
Optionaloperator= (Optional< U > const &other)
 
Optionaloperator= (T &&other)
 
Optionaloperator= (T const &other)
 
void reset ()
 
void swap (Optional &rhs)
 
value_typevalue ()
 
const value_typevalue () const
 
template<class U >
value_type value_or (U const &v) const
 

Public Types

typedef T value_type
 

Constructor & Destructor Documentation

◆ Optional() [1/6]

Optional ( )
inline

Definition at line 192 of file optional.hpp.

◆ Optional() [2/6]

Optional ( nullopt_t  )
inline

Definition at line 196 of file optional.hpp.

◆ Optional() [3/6]

Optional ( T const &  arg)
inline

Definition at line 200 of file optional.hpp.

◆ Optional() [4/6]

Optional ( T &&  arg)
inline

Definition at line 205 of file optional.hpp.

◆ Optional() [5/6]

Optional ( Optional< U > const &  other)
inline

Definition at line 211 of file optional.hpp.

◆ Optional() [6/6]

Optional ( Optional< U > &&  other)
inline

Definition at line 220 of file optional.hpp.

Member Function Documentation

◆ has_value()

bool has_value ( ) const
inline

Definition at line 310 of file optional.hpp.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Definition at line 305 of file optional.hpp.

◆ operator*() [1/2]

value_type& operator* ( )
inline

Definition at line 299 of file optional.hpp.

◆ operator*() [2/2]

const value_type& operator* ( ) const
inline

Definition at line 293 of file optional.hpp.

◆ operator->() [1/2]

value_type* operator-> ( )
inline

Definition at line 287 of file optional.hpp.

◆ operator->() [2/2]

const value_type* operator-> ( ) const
inline

Definition at line 281 of file optional.hpp.

◆ operator=() [1/5]

Optional& operator= ( nullopt_t  )
inline

Definition at line 228 of file optional.hpp.

◆ operator=() [2/5]

Optional& operator= ( Optional< U > &&  other)
inline

Definition at line 259 of file optional.hpp.

◆ operator=() [3/5]

Optional& operator= ( Optional< U > const &  other)
inline

Definition at line 249 of file optional.hpp.

◆ operator=() [4/5]

Optional& operator= ( T &&  other)
inline

Definition at line 241 of file optional.hpp.

◆ operator=() [5/5]

Optional& operator= ( T const &  other)
inline

Definition at line 234 of file optional.hpp.

◆ reset()

void reset ( )
inline

Definition at line 343 of file optional.hpp.

◆ swap()

void swap ( Optional< T > &  rhs)
inline

Definition at line 268 of file optional.hpp.

◆ value() [1/2]

value_type& value ( )
inline

Definition at line 324 of file optional.hpp.

◆ value() [2/2]

const value_type& value ( ) const
inline

Definition at line 315 of file optional.hpp.

◆ value_or()

value_type value_or ( U const &  v) const
inline

Definition at line 334 of file optional.hpp.

Member Typedef Documentation

◆ value_type

typedef T value_type

Definition at line 186 of file optional.hpp.


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