Public Types | Public Member Functions | Private Types | Private Member Functions | List of all members
absl::optional< T > Class Template Reference

#include <optional.h>

Inheritance diagram for absl::optional< T >:
Inheritance graph
[legend]

Public Types

typedef T value_type
 

Public Member Functions

template<typename... Args, typename = typename std::enable_if< std::is_constructible<T, Args&&...>::value>::type>
T & emplace (Args &&... args)
 
template<typename U , typename... Args, typename = typename std::enable_if<std::is_constructible< T, std::initializer_list<U>&, Args&&...>::value>::type>
T & emplace (std::initializer_list< U > il, Args &&... args)
 
constexpr bool has_value () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr const T & operator* () const &
 
T & operator* () &
 
constexpr const T && operator* () const &&
 
T && operator* () &&
 
const T * operator-> () const
 
T * operator-> ()
 
optionaloperator= (nullopt_t) noexcept
 
optionaloperator= (const optional &src)=default
 
optionaloperator= (optional &&src)=default
 
template<typename U = T, typename = typename std::enable_if<absl::conjunction< absl::negation< std::is_same<optional<T>, typename std::decay<U>::type>>, absl::negation< absl::conjunction<std::is_scalar<T>, std::is_same<T, typename std::decay<U>::type>>>, std::is_constructible<T, U>, std::is_assignable<T&, U>>::value>::type>
optionaloperator= (U &&v)
 
template<typename U , typename = typename std::enable_if<absl::conjunction< absl::negation<std::is_same<T, U>>, std::is_constructible<T, const U&>, std::is_assignable<T&, const U&>, absl::negation< optional_internal:: is_constructible_convertible_assignable_from_optional< T, U>>>::value>::type>
optionaloperator= (const optional< U > &rhs)
 
template<typename U , typename = typename std::enable_if<absl::conjunction< absl::negation<std::is_same<T, U>>, std::is_constructible<T, U>, std::is_assignable<T&, U>, absl::negation< optional_internal:: is_constructible_convertible_assignable_from_optional< T, U>>>::value>::type>
optionaloperator= (optional< U > &&rhs)
 
constexpr optional () noexcept
 
constexpr optional (nullopt_t) noexcept
 
 optional (const optional &src)=default
 
 optional (optional &&src)=default
 
template<typename InPlaceT , typename... Args, absl::enable_if_t< absl::conjunction< std::is_same< InPlaceT, in_place_t >, std::is_constructible< T, Args &&... > >::value > * = nullptr>
constexpr optional (InPlaceT, Args &&... args)
 
template<typename U , typename... Args, typename = typename std::enable_if<std::is_constructible< T, std::initializer_list<U>&, Args&&...>::value>::type>
constexpr optional (in_place_t, std::initializer_list< U > il, Args &&... args)
 
template<typename U = T, typename std::enable_if< absl::conjunction< absl::negation< std::is_same< in_place_t, typename std::decay< U >::type > >, absl::negation< std::is_same< optional< T >, typename std::decay< U >::type > >, std::is_convertible< U &&, T >, std::is_constructible< T, U &&> >::value, bool >::type = false>
constexpr optional (U &&v)
 
template<typename U = T, typename std::enable_if< absl::conjunction< absl::negation< std::is_same< in_place_t, typename std::decay< U >::type >>, absl::negation< std::is_same< optional< T >, typename std::decay< U >::type >>, absl::negation< std::is_convertible< U &&, T >>, std::is_constructible< T, U &&>>::value, bool >::type = false>
constexpr optional (U &&v)
 
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U > >, std::is_constructible< T, const U &>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U > >, std::is_convertible< const U &, T > >::value, bool >::type = false>
 optional (const optional< U > &rhs)
 
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U >>, std::is_constructible< T, const U &>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U >>, absl::negation< std::is_convertible< const U &, T >>>::value, bool >::type = false>
 optional (const optional< U > &rhs)
 
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U > >, std::is_constructible< T, U &&>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U > >, std::is_convertible< U &&, T > >::value, bool >::type = false>
 optional (optional< U > &&rhs)
 
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U >>, std::is_constructible< T, U &&>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U >>, absl::negation< std::is_convertible< U &&, T >>>::value, bool >::type = false>
 optional (optional< U > &&rhs)
 
ABSL_ATTRIBUTE_REINITIALIZES void reset () noexcept
 
void swap (optional &rhs) noexcept(std::is_nothrow_move_constructible< T >::value &&type_traits_internal::IsNothrowSwappable< T >::value)
 
constexpr const T & value () const &
 
T & value () &
 
T && value () &&
 
constexpr const T && value () const &&
 
template<typename U >
constexpr T value_or (U &&v) const &
 
template<typename U >
value_or (U &&v) &&
 
 ~optional ()=default
 

Private Types

using data_base = optional_internal::optional_data< T >
 

Private Member Functions

constexpr const T & reference () const
 
T & reference ()
 

Detailed Description

template<typename T>
class absl::optional< T >

Definition at line 60 of file internal/optional.h.

Member Typedef Documentation

◆ data_base

template<typename T>
using absl::optional< T >::data_base = optional_internal::optional_data<T>
private

Definition at line 121 of file optional.h.

◆ value_type

template<typename T>
typedef T absl::optional< T >::value_type

Definition at line 124 of file optional.h.

Constructor & Destructor Documentation

◆ optional() [1/12]

template<typename T>
constexpr absl::optional< T >::optional ( )
inlinenoexcept

Definition at line 130 of file optional.h.

◆ optional() [2/12]

template<typename T>
constexpr absl::optional< T >::optional ( nullopt_t  )
inlinenoexcept

Definition at line 133 of file optional.h.

◆ optional() [3/12]

template<typename T>
absl::optional< T >::optional ( const optional< T > &  src)
default

◆ optional() [4/12]

template<typename T>
absl::optional< T >::optional ( optional< T > &&  src)
default

◆ optional() [5/12]

template<typename T>
template<typename InPlaceT , typename... Args, absl::enable_if_t< absl::conjunction< std::is_same< InPlaceT, in_place_t >, std::is_constructible< T, Args &&... > >::value > * = nullptr>
constexpr absl::optional< T >::optional ( InPlaceT  ,
Args &&...  args 
)
inlineexplicit

Definition at line 149 of file optional.h.

◆ optional() [6/12]

template<typename T>
template<typename U , typename... Args, typename = typename std::enable_if<std::is_constructible< T, std::initializer_list<U>&, Args&&...>::value>::type>
constexpr absl::optional< T >::optional ( in_place_t  ,
std::initializer_list< U >  il,
Args &&...  args 
)
inlineexplicit

Definition at line 159 of file optional.h.

◆ optional() [7/12]

template<typename T>
template<typename U = T, typename std::enable_if< absl::conjunction< absl::negation< std::is_same< in_place_t, typename std::decay< U >::type > >, absl::negation< std::is_same< optional< T >, typename std::decay< U >::type > >, std::is_convertible< U &&, T >, std::is_constructible< T, U &&> >::value, bool >::type = false>
constexpr absl::optional< T >::optional ( U &&  v)
inline

Definition at line 175 of file optional.h.

◆ optional() [8/12]

template<typename T>
template<typename U = T, typename std::enable_if< absl::conjunction< absl::negation< std::is_same< in_place_t, typename std::decay< U >::type >>, absl::negation< std::is_same< optional< T >, typename std::decay< U >::type >>, absl::negation< std::is_convertible< U &&, T >>, std::is_constructible< T, U &&>>::value, bool >::type = false>
constexpr absl::optional< T >::optional ( U &&  v)
inlineexplicit

Definition at line 188 of file optional.h.

◆ optional() [9/12]

template<typename T>
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U > >, std::is_constructible< T, const U &>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U > >, std::is_convertible< const U &, T > >::value, bool >::type = false>
absl::optional< T >::optional ( const optional< U > &  rhs)
inline

Definition at line 202 of file optional.h.

◆ optional() [10/12]

template<typename T>
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U >>, std::is_constructible< T, const U &>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U >>, absl::negation< std::is_convertible< const U &, T >>>::value, bool >::type = false>
absl::optional< T >::optional ( const optional< U > &  rhs)
inlineexplicit

Definition at line 219 of file optional.h.

◆ optional() [11/12]

template<typename T>
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U > >, std::is_constructible< T, U &&>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U > >, std::is_convertible< U &&, T > >::value, bool >::type = false>
absl::optional< T >::optional ( optional< U > &&  rhs)
inline

Definition at line 236 of file optional.h.

◆ optional() [12/12]

template<typename T>
template<typename U , typename std::enable_if< absl::conjunction< absl::negation< std::is_same< T, U >>, std::is_constructible< T, U &&>, absl::negation< optional_internal::is_constructible_convertible_from_optional< T, U >>, absl::negation< std::is_convertible< U &&, T >>>::value, bool >::type = false>
absl::optional< T >::optional ( optional< U > &&  rhs)
inlineexplicit

Definition at line 253 of file optional.h.

◆ ~optional()

template<typename T>
absl::optional< T >::~optional ( )
default

Member Function Documentation

◆ emplace() [1/2]

template<typename T>
template<typename... Args, typename = typename std::enable_if< std::is_constructible<T, Args&&...>::value>::type>
T& absl::optional< T >::emplace ( Args &&...  args)
inline

Definition at line 354 of file optional.h.

◆ emplace() [2/2]

template<typename T>
template<typename U , typename... Args, typename = typename std::enable_if<std::is_constructible< T, std::initializer_list<U>&, Args&&...>::value>::type>
T& absl::optional< T >::emplace ( std::initializer_list< U >  il,
Args &&...  args 
)
inline

Definition at line 374 of file optional.h.

◆ has_value()

template<typename T>
constexpr bool absl::optional< T >::has_value ( ) const
inlinenoexcept

Definition at line 455 of file optional.h.

◆ operator bool()

template<typename T>
constexpr absl::optional< T >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 449 of file optional.h.

◆ operator*() [1/4]

template<typename T>
constexpr const T& absl::optional< T >::operator* ( ) const &
inline

Definition at line 424 of file optional.h.

◆ operator*() [2/4]

template<typename T>
T& absl::optional< T >::operator* ( ) &
inline

Definition at line 427 of file optional.h.

◆ operator*() [3/4]

template<typename T>
constexpr const T&& absl::optional< T >::operator* ( ) const &&
inline

Definition at line 431 of file optional.h.

◆ operator*() [4/4]

template<typename T>
T&& absl::optional< T >::operator* ( ) &&
inline

Definition at line 434 of file optional.h.

◆ operator->() [1/2]

template<typename T>
const T* absl::optional< T >::operator-> ( ) const
inline

Definition at line 411 of file optional.h.

◆ operator->() [2/2]

template<typename T>
T* absl::optional< T >::operator-> ( )
inline

Definition at line 415 of file optional.h.

◆ operator=() [1/6]

template<typename T>
optional& absl::optional< T >::operator= ( nullopt_t  )
inlinenoexcept

Definition at line 270 of file optional.h.

◆ operator=() [2/6]

template<typename T>
optional& absl::optional< T >::operator= ( const optional< T > &  src)
default

◆ operator=() [3/6]

template<typename T>
optional& absl::optional< T >::operator= ( optional< T > &&  src)
default

◆ operator=() [4/6]

template<typename T>
template<typename U = T, typename = typename std::enable_if<absl::conjunction< absl::negation< std::is_same<optional<T>, typename std::decay<U>::type>>, absl::negation< absl::conjunction<std::is_scalar<T>, std::is_same<T, typename std::decay<U>::type>>>, std::is_constructible<T, U>, std::is_assignable<T&, U>>::value>::type>
optional& absl::optional< T >::operator= ( U &&  v)
inline

Definition at line 291 of file optional.h.

◆ operator=() [5/6]

template<typename T>
template<typename U , typename = typename std::enable_if<absl::conjunction< absl::negation<std::is_same<T, U>>, std::is_constructible<T, const U&>, std::is_assignable<T&, const U&>, absl::negation< optional_internal:: is_constructible_convertible_assignable_from_optional< T, U>>>::value>::type>
optional& absl::optional< T >::operator= ( const optional< U > &  rhs)
inline

Definition at line 305 of file optional.h.

◆ operator=() [6/6]

template<typename T>
template<typename U , typename = typename std::enable_if<absl::conjunction< absl::negation<std::is_same<T, U>>, std::is_constructible<T, U>, std::is_assignable<T&, U>, absl::negation< optional_internal:: is_constructible_convertible_assignable_from_optional< T, U>>>::value>::type>
optional& absl::optional< T >::operator= ( optional< U > &&  rhs)
inline

Definition at line 322 of file optional.h.

◆ reference() [1/2]

template<typename T>
constexpr const T& absl::optional< T >::reference ( ) const
inlineprivate

Definition at line 521 of file optional.h.

◆ reference() [2/2]

template<typename T>
T& absl::optional< T >::reference ( )
inlineprivate

Definition at line 522 of file optional.h.

◆ reset()

template<typename T>
ABSL_ATTRIBUTE_REINITIALIZES void absl::optional< T >::reset ( )
inlinenoexcept

Definition at line 336 of file optional.h.

◆ swap()

template<typename T>
void absl::optional< T >::swap ( optional< T > &  rhs)
inlinenoexcept

Definition at line 383 of file optional.h.

◆ value() [1/4]

template<typename T>
constexpr const T& absl::optional< T >::value ( ) const &
inline

Definition at line 469 of file optional.h.

◆ value() [2/4]

template<typename T>
T& absl::optional< T >::value ( ) &
inline

Definition at line 474 of file optional.h.

◆ value() [3/4]

template<typename T>
T&& absl::optional< T >::value ( ) &&
inline

Definition at line 479 of file optional.h.

◆ value() [4/4]

template<typename T>
constexpr const T&& absl::optional< T >::value ( ) const &&
inline

Definition at line 485 of file optional.h.

◆ value_or() [1/2]

template<typename T>
template<typename U >
constexpr T absl::optional< T >::value_or ( U &&  v) const &
inline

Definition at line 500 of file optional.h.

◆ value_or() [2/2]

template<typename T>
template<typename U >
T absl::optional< T >::value_or ( U &&  v) &&
inline

Definition at line 510 of file optional.h.


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


abseil_cpp
Author(s):
autogenerated on Mon Feb 28 2022 21:31:22