Standard library » Containers » Optional module

std::optional like container.

It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.

Files

file bn_optional.h
file bn_optional_fwd.h

Classes

class bn::nullopt_t
Empty class type used to indicate an optional type with uninitialized state.
template<typename Type>
struct bn::hash<optional<Type>>
Hash support for optional.
template<typename Type>
class bn::optional
std::optional like container.

Functions

template<typename Type, class... Args>
auto make_optional(Args && ... args) -> optional<Type> constexpr
Constructs an object and wraps it in a optional.

Function documentation

template<typename Type, class... Args>
optional<Type> make_optional(Args && ... args) constexpr

Constructs an object and wraps it in a optional.

Template parameters
Type Type of the object to construct.
Args Type of the arguments of the object to construct.
Parameters
args Parameters of the object to construct.
Returns An optional managing the new object.