STX  1.0.0
List of all members
stx::Some< T > Struct Template Reference

#include <option_result.h>

Detailed Description

template<typename T>
struct stx::Some< T >

value-variant for Option<T> wrapping the contained value

Usage

Note that Some is only a value-forwarding type. It doesn't make copies of its constructor arguments and only accepts r-values.

What does this mean?

For example, You can:

Option a = Some(vector{1, 2, 3, 4});

You can't:

vector<int> x {1, 2, 3, 4};
Option a = Some(x);

But, to explicitly make a take ownership, you will:

vector<int> x {1, 2, 3, 4};
Option a = Some(std::move(x));

Constexpr ?

C++ 17 and above

Member Typedef Documentation

◆ value_type

template<typename T>
using stx::Some< T >::value_type = T

Constructor & Destructor Documentation

◆ Some() [1/3]

template<typename T>
constexpr stx::Some< T >::Some ( T &&  value)
inlineexplicit

a Some<T> can only be constructed with an r-value of type T

◆ Some() [2/3]

template<typename T>
constexpr stx::Some< T >::Some ( Some< T > &&  rhs)
default

◆ Some() [3/3]

template<typename T>
constexpr stx::Some< T >::Some ( Some< T > const &  )
default

◆ ~Some()

template<typename T>
STX_CXX20_DESTRUCTOR_CONSTEXPR stx::Some< T >::~Some ( )
default

Member Function Documentation

◆ operator!=() [1/2]

template<typename T>
template<typename U >
constexpr bool stx::Some< T >::operator!= ( Some< U > const &  cmp) const
inline

◆ operator!=() [2/2]

template<typename T>
constexpr bool stx::Some< T >::operator!= ( NoneType const &  ) const
inlinenoexcept

◆ operator=() [1/2]

template<typename T>
constexpr Some& stx::Some< T >::operator= ( Some< T > &&  rhs)
default

◆ operator=() [2/2]

template<typename T>
constexpr Some& stx::Some< T >::operator= ( Some< T > const &  )
default

◆ operator==() [1/2]

template<typename T>
template<typename U >
constexpr bool stx::Some< T >::operator== ( Some< U > const &  cmp) const
inline

◆ operator==() [2/2]

template<typename T>
constexpr bool stx::Some< T >::operator== ( NoneType const &  ) const
inlinenoexcept

◆ value() [1/4]

template<typename T>
constexpr T const& stx::Some< T >::value ( ) const &
inlinenoexcept

◆ value() [2/4]

template<typename T>
constexpr T& stx::Some< T >::value ( ) &
inlinenoexcept

◆ value() [3/4]

template<typename T>
constexpr T const stx::Some< T >::value ( ) const &&
inline

◆ value() [4/4]

template<typename T>
constexpr T stx::Some< T >::value ( ) &&
inline

Friends And Related Function Documentation

◆ Option

template<typename T>
template<typename Tp >
friend struct Option
friend

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