SPH
Classes | Functions | Variables
Optional.h File Reference

Wrapper of type value of which may or may not be present. More...

#include "common/Assert.h"
#include "common/Traits.h"
#include "objects/wrappers/AlignedStorage.h"
#include <type_traits>

Go to the source code of this file.

Classes

struct  NothingType
 
class  Optional< Type >
 Wrapper of type value of which may or may not be present. More...
 

Functions

template<typename T1 , typename T2 >
Optional< T1 > optionalCast (const Optional< T2 > &opt)
 
template<typename T >
bool operator== (const Optional< T > &opt, const T &t)
 
template<typename T >
bool operator== (const T &t, const Optional< T > &opt)
 
template<typename T >
bool operator== (const Optional< T > &opt1, const Optional< T > &opt2)
 Achtung! Even if both optionals are uninitialized, the comparison returns false. More...
 
template<typename T >
bool operator== (const Optional< T > &opt, const NothingType &)
 

Variables

const NothingType NOTHING
 

Detailed Description

Wrapper of type value of which may or may not be present.

Author
Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz)

Definition in file Optional.h.

Function Documentation

◆ operator==() [1/4]

template<typename T >
bool operator== ( const Optional< T > &  opt,
const NothingType  
)

Definition at line 269 of file Optional.h.

◆ operator==() [2/4]

template<typename T >
bool operator== ( const Optional< T > &  opt,
const T &  t 
)

Definition at line 243 of file Optional.h.

◆ operator==() [3/4]

template<typename T >
bool operator== ( const Optional< T > &  opt1,
const Optional< T > &  opt2 
)

Achtung! Even if both optionals are uninitialized, the comparison returns false.

Definition at line 260 of file Optional.h.

◆ operator==() [4/4]

template<typename T >
bool operator== ( const T &  t,
const Optional< T > &  opt 
)

Definition at line 251 of file Optional.h.

◆ optionalCast()

template<typename T1 , typename T2 >
Optional<T1> optionalCast ( const Optional< T2 > &  opt)

Definition at line 235 of file Optional.h.

Variable Documentation

◆ NOTHING

const NothingType NOTHING

Definition at line 16 of file Optional.h.