libstdc++: std::experimental::fundamentals_v1::optional< _Tp > Class Template Reference

libstdc++

std::experimental::fundamentals_v1::optional< _Tp > Class Template Reference
Technical Specifications » Library Fundamentals TS » Optional values

`#include <optional>`

## Public Types
using | value_type

## Public Member Functions
template<typename _Up = _Tp, enable_if_t< __and_< __not_< is_same< optional< _Tp >, decay_t< _Up > > >, is_constructible< _Tp, _Up && >, __not_< is_convertible< _Up &&, _Tp > > >::value, bool > = false>
constexpr | optional (_Up &&__t)
template<typename _Up = _Tp, enable_if_t< __and_< __not_< is_same< optional< _Tp >, decay_t< _Up > > >, is_constructible< _Tp, _Up && >, is_convertible< _Up &&, _Tp > >::value, bool > = true>
constexpr | optional (_Up &&__t)
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, const _Up & >, __not_< is_convertible< const _Up &, _Tp > >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = false>
constexpr | optional (const optional< _Up > &__t)
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, const _Up & >, is_convertible< const _Up &, _Tp >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = true>
constexpr | optional (const optional< _Up > &__t)
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, _Up && >, __not_< is_convertible< _Up &&, _Tp > >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = false>
constexpr | optional (optional< _Up > &&__t)
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, _Up && >, is_convertible< _Up &&, _Tp >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = true>
constexpr | optional (optional< _Up > &&__t)
template<typename... _Args>
enable_if_t< is_constructible< _Tp, _Args &&... >::value > | emplace (_Args &&... __args)
template<typename _Up, typename... _Args>
enable_if_t< is_constructible< _Tp, initializer_list< _Up > &, _Args &&... >::value > | emplace (initializer_list< _Up > __il, _Args &&... __args)
constexpr | operator bool () const noexcept
constexpr _Tp & | operator* () &
constexpr _Tp && | operator* () &&
constexpr const _Tp & | operator* () const &
constexpr const _Tp && | operator* () const &&
_Tp * | operator-> ()
constexpr const _Tp * | operator-> () const
template<typename _Up = _Tp>
enable_if_t< __and_< __not_< is_same< optional< _Tp >, decay_t< _Up > > >, is_constructible< _Tp, _Up >, __not_< __and_< is_scalar< _Tp >, is_same< _Tp, decay_t< _Up > > > >, is_assignable< _Tp &, _Up > >::value, optional & > | operator= (_Up &&__u)
template<typename _Up>
enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, const _Up & >, is_assignable< _Tp &, _Up >, __not_< __converts_from_optional< _Tp, _Up > >, __not_< __assigns_from_optional< _Tp, _Up > > >::value, optional & > | operator= (const optional< _Up > &__u)
optional & | operator= (nullopt_t) noexcept
template<typename _Up>
enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, _Up >, is_assignable< _Tp &, _Up >, __not_< __converts_from_optional< _Tp, _Up > >, __not_< __assigns_from_optional< _Tp, _Up > > >::value, optional & > | operator= (optional< _Up > &&__u)
void | swap (optional &__other) noexcept(is_nothrow_move_constructible< _Tp >() &&__is_nothrow_swappable< _Tp >::value)
constexpr _Tp & | value () &
constexpr _Tp && | value () &&
constexpr const _Tp & | value () const &
constexpr const _Tp && | value () const &&
template<typename _Up>
_Tp | value_or (_Up &&__u) &&
template<typename _Up>
constexpr _Tp | value_or (_Up &&__u) const &

## Detailed Description

template<typename _Tp>
class std::experimental::fundamentals_v1::optional< _Tp >

Class template for optional values.

Definition at line 426 of file experimental/optional.

## Member Typedef Documentation

## ◆ value_type

template<typename _Tp>

using std::experimental::fundamentals_v1::optional< _Tp >::value_type

Definition at line 449 of file experimental/optional.

## Constructor & Destructor Documentation

## ◆ optional() [1/6]

template<typename _Tp>
template<typename _Up = _Tp, enable_if_t< __and_< __not_< is_same< optional< _Tp >, decay_t< _Up > > >, is_constructible< _Tp, _Up && >, is_convertible< _Up &&, _Tp > >::value, bool > = true>

std::experimental::fundamentals_v1::optional< _Tp >::optional | ( | _Up && | __t | ) |
| inlineconstexpr

Definition at line 462 of file experimental/optional.

## ◆ optional() [2/6]

template<typename _Tp>
template<typename _Up = _Tp, enable_if_t< __and_< __not_< is_same< optional< _Tp >, decay_t< _Up > > >, is_constructible< _Tp, _Up && >, __not_< is_convertible< _Up &&, _Tp > > >::value, bool > = false>

std::experimental::fundamentals_v1::optional< _Tp >::optional | ( | _Up && | __t | ) |
| inlineexplicitconstexpr

Definition at line 471 of file experimental/optional.

## ◆ optional() [3/6]

template<typename _Tp>
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, const _Up & >, is_convertible< const _Up &, _Tp >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = true>

std::experimental::fundamentals_v1::optional< _Tp >::optional | ( | const optional< _Up > & | __t | ) |
| inlineconstexpr

Definition at line 481 of file experimental/optional.

## ◆ optional() [4/6]

template<typename _Tp>
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, const _Up & >, __not_< is_convertible< const _Up &, _Tp > >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = false>

std::experimental::fundamentals_v1::optional< _Tp >::optional | ( | const optional< _Up > & | __t | ) |
| inlineexplicitconstexpr

Definition at line 494 of file experimental/optional.

## ◆ optional() [5/6]

template<typename _Tp>
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, _Up && >, is_convertible< _Up &&, _Tp >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = true>

std::experimental::fundamentals_v1::optional< _Tp >::optional | ( | optional< _Up > && | __t | ) |
| inlineconstexpr

Definition at line 507 of file experimental/optional.

## ◆ optional() [6/6]

template<typename _Tp>
template<typename _Up, enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, _Up && >, __not_< is_convertible< _Up &&, _Tp > >, __not_< __converts_from_optional< _Tp, _Up > > >::value, bool > = false>

std::experimental::fundamentals_v1::optional< _Tp >::optional | ( | optional< _Up > && | __t | ) |
| inlineexplicitconstexpr

Definition at line 520 of file experimental/optional.

## Member Function Documentation

## ◆ emplace() [1/2]

template<typename _Tp>
template<typename... _Args>

enable_if_t< is_constructible< _Tp, _Args &&... >::value > std::experimental::fundamentals_v1::optional< _Tp >::emplace | ( | _Args &&... | __args | ) |
| inline

Definition at line 605 of file experimental/optional.

## ◆ emplace() [2/2]

template<typename _Tp>
template<typename _Up, typename... _Args>

enable_if_t< is_constructible< _Tp, initializer_list< _Up > &, _Args &&... >::value > std::experimental::fundamentals_v1::optional< _Tp >::emplace | ( | initializer_list< _Up > | __il,
|  | _Args &&... | __args )
| inline

Definition at line 614 of file experimental/optional.

## ◆ operator bool()

template<typename _Tp>

std::experimental::fundamentals_v1::optional< _Tp >::operator bool | ( |  | ) | const
| inlineexplicitconstexprnoexcept

Definition at line 669 of file experimental/optional.

## ◆ operator*() [1/4]

template<typename _Tp>

_Tp & std::experimental::fundamentals_v1::optional< _Tp >::operator* | ( |  | ) | &
| inlineconstexpr

Definition at line 658 of file experimental/optional.

## ◆ operator*() [2/4]

template<typename _Tp>

_Tp && std::experimental::fundamentals_v1::optional< _Tp >::operator* | ( |  | ) | &&
| inlineconstexpr

Definition at line 662 of file experimental/optional.

## ◆ operator*() [3/4]

template<typename _Tp>

const _Tp & std::experimental::fundamentals_v1::optional< _Tp >::operator* | ( |  | ) | const &
| inlineconstexpr

Definition at line 654 of file experimental/optional.

## ◆ operator*() [4/4]

template<typename _Tp>

const _Tp && std::experimental::fundamentals_v1::optional< _Tp >::operator* | ( |  | ) | const &&
| inlineconstexpr

Definition at line 666 of file experimental/optional.

## ◆ operator->() [1/2]

template<typename _Tp>

_Tp * std::experimental::fundamentals_v1::optional< _Tp >::operator-> | ( |  | ) |
| inline

Definition at line 650 of file experimental/optional.

## ◆ operator->() [2/2]

template<typename _Tp>

const _Tp * std::experimental::fundamentals_v1::optional< _Tp >::operator-> | ( |  | ) | const
| inlineconstexpr

Definition at line 646 of file experimental/optional.

## ◆ operator=() [1/4]

template<typename _Tp>
template<typename _Up = _Tp>

enable_if_t< __and_< __not_< is_same< optional< _Tp >, decay_t< _Up > > >, is_constructible< _Tp, _Up >, __not_< __and_< is_scalar< _Tp >, is_same< _Tp, decay_t< _Up > > > >, is_assignable< _Tp &, _Up > >::value, optional & > std::experimental::fundamentals_v1::optional< _Tp >::operator= | ( | _Up && | __u | ) |
| inline

Definition at line 542 of file experimental/optional.

## ◆ operator=() [2/4]

template<typename _Tp>
template<typename _Up>

enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, const _Up & >, is_assignable< _Tp &, _Up >, __not_< __converts_from_optional< _Tp, _Up > >, __not_< __assigns_from_optional< _Tp, _Up > > >::value, optional & > std::experimental::fundamentals_v1::optional< _Tp >::operator= | ( | const optional< _Up > & | __u | ) |
| inline

Definition at line 561 of file experimental/optional.

## ◆ operator=() [3/4]

template<typename _Tp>

optional & std::experimental::fundamentals_v1::optional< _Tp >::operator= | ( | nullopt_t |  | ) |
| inlinenoexcept

Definition at line 528 of file experimental/optional.

## ◆ operator=() [4/4]

template<typename _Tp>
template<typename _Up>

enable_if_t< __and_< __not_< is_same< _Tp, _Up > >, is_constructible< _Tp, _Up >, is_assignable< _Tp &, _Up >, __not_< __converts_from_optional< _Tp, _Up > >, __not_< __assigns_from_optional< _Tp, _Up > > >::value, optional & > std::experimental::fundamentals_v1::optional< _Tp >::operator= | ( | optional< _Up > && | __u | ) |
| inline

Definition at line 586 of file experimental/optional.

## ◆ swap()

template<typename _Tp>

void std::experimental::fundamentals_v1::optional< _Tp >::swap | ( | optional< _Tp > & | __other | ) |
| inlinenoexcept

Definition at line 624 of file experimental/optional.

## ◆ value() [1/4]

template<typename _Tp>

_Tp & std::experimental::fundamentals_v1::optional< _Tp >::value | ( |  | ) | &
| inlineconstexpr

Definition at line 682 of file experimental/optional.

## ◆ value() [2/4]

template<typename _Tp>

_Tp && std::experimental::fundamentals_v1::optional< _Tp >::value | ( |  | ) | &&
| inlineconstexpr

Definition at line 691 of file experimental/optional.

## ◆ value() [3/4]

template<typename _Tp>

const _Tp & std::experimental::fundamentals_v1::optional< _Tp >::value | ( |  | ) | const &
| inlineconstexpr

Definition at line 673 of file experimental/optional.

## ◆ value() [4/4]

template<typename _Tp>

const _Tp && std::experimental::fundamentals_v1::optional< _Tp >::value | ( |  | ) | const &&
| inlineconstexpr

Definition at line 700 of file experimental/optional.

## ◆ value_or() [1/2]

template<typename _Tp>
template<typename _Up>

_Tp std::experimental::fundamentals_v1::optional< _Tp >::value_or | ( | _Up && | __u | ) | &&
| inline

Definition at line 724 of file experimental/optional.

## ◆ value_or() [2/2]

template<typename _Tp>
template<typename _Up>

_Tp std::experimental::fundamentals_v1::optional< _Tp >::value_or | ( | _Up && | __u | ) | const &
| inlineconstexpr

Definition at line 710 of file experimental/optional.

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

- experimental/optional