libhatchet
Loading...
Searching...
No Matches
hxoptional.hpp File Reference

Go to the source code of this file.

Classes

struct  hxnullopt_t
class  hxoptional< T >

Functions

template<typename T>
hxoptional< hxremove_cvref_t< T > > hxmake_optional (T &&value_)
template<typename T, typename... args_t_>
hxoptional< T > hxmake_optional (args_t_ &&... args_)
template<typename T>
hxhash_t hxkey_hash (const hxoptional< T > &opt_)

Variables

constexpr hxnullopt_t hxnullopt {0}

Detailed Description

An optional value type.

Implements std::optional<T>. See hxref for a std::optional<T&> equivalent.

Function Documentation

◆ hxkey_hash()

template<typename T>
hxhash_t hxkey_hash ( const hxoptional< T > & opt_)

hxkey_hash(hxoptional<T>) - Returns the hash of the contained value if engaged, otherwise 1u.

  • opt : The optional to hash.

◆ hxmake_optional() [1/2]

template<typename T, typename... args_t_>
hxoptional< T > hxmake_optional ( args_t_ &&... args_)

hxmake_optional<T> - Returns an engaged hxoptional<T> constructed in place by forwarding args to the constructor of T.

  • args : Arguments forwarded to the constructor of T.

◆ hxmake_optional() [2/2]

template<typename T>
hxoptional< hxremove_cvref_t< T > > hxmake_optional ( T && value_)

hxmake_optional - Returns an engaged hxoptional<hxremove_cvref_t<T>> constructed by forwarding value.

  • value_ : The value to forward into the optional.

Variable Documentation

◆ hxnullopt

hxnullopt_t hxnullopt {0}
inlineconstexpr

hxnullopt - A sentinel value of type hxnullopt_t representing a disengaged hxoptional.

Implements std::nullopt.