STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Macros | Functions | Variables
optional File Reference
#include <initializer_list>
#include <stdexcept>
#include <type_traits>
#include <utility>
#include <xmemory0>
#include <xsmf_control.h>

Classes

struct  nullopt_t
 
struct  nullopt_t::_Tag
 
class  bad_optional_access
 
struct  _Optional_destruct_base< _Ty, bool >
 
struct  _Optional_destruct_base< _Ty, true >
 
struct  _Optional_destruct_base< _Ty, false >
 
struct  _Optional_construct_base< _Ty >
 
struct  _Optional_copymove_base< _Ty, bool >
 
struct  _Optional_copymove_base< _Ty, true >
 
struct  _Optional_copymove_base< _Ty, false >
 
struct  hash< optional< _Ty > >
 

Macros

#define _OPTIONAL_
 

Functions

template<class _Ty >
class __declspec (empty_bases) optional
 
template<class _Ty >
constexpr bool operator== (const optional< _Ty > &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator!= (const optional< _Ty > &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator< (const optional< _Ty > &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator> (const optional< _Ty > &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator<= (const optional< _Ty > &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator>= (const optional< _Ty > &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator== (const optional< _Ty > &_Left, nullopt_t) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator== (nullopt_t, const optional< _Ty > &_Right) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator!= (const optional< _Ty > &_Left, nullopt_t) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator!= (nullopt_t, const optional< _Ty > &_Right) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator< (const optional< _Ty > &, nullopt_t) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator< (nullopt_t, const optional< _Ty > &_Right) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator<= (const optional< _Ty > &_Left, nullopt_t) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator<= (nullopt_t, const optional< _Ty > &) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator> (const optional< _Ty > &_Left, nullopt_t) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator> (nullopt_t, const optional< _Ty > &) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator>= (const optional< _Ty > &, nullopt_t) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator>= (nullopt_t, const optional< _Ty > &_Right) _NOEXCEPT
 
template<class _Ty >
constexpr bool operator== (const optional< _Ty > &_Left, const _Ty &_Right)
 
template<class _Ty >
constexpr bool operator== (const _Ty &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator!= (const optional< _Ty > &_Left, const _Ty &_Right)
 
template<class _Ty >
constexpr bool operator!= (const _Ty &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator< (const optional< _Ty > &_Left, const _Ty &_Right)
 
template<class _Ty >
constexpr bool operator< (const _Ty &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator<= (const optional< _Ty > &_Left, const _Ty &_Right)
 
template<class _Ty >
constexpr bool operator<= (const _Ty &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator> (const optional< _Ty > &_Left, const _Ty &_Right)
 
template<class _Ty >
constexpr bool operator> (const _Ty &_Left, const optional< _Ty > &_Right)
 
template<class _Ty >
constexpr bool operator>= (const optional< _Ty > &_Left, const _Ty &_Right)
 
template<class _Ty >
constexpr bool operator>= (const _Ty &_Left, const optional< _Ty > &_Right)
 
template<class _Ty , class = enable_if_t<is_move_constructible<_Ty>::value && is_swappable<_Ty>::value>>
void swap (optional< _Ty > &_Left, optional< _Ty > &_Right) _NOEXCEPT_OP(_NOEXCEPT_OP(_Left.swap(_Right)))
 
template<class _Ty >
constexpr optional< decay_t< _Ty > > make_optional (_Ty &&_Value)
 
template<class _Ty , class... _Types>
constexpr optional< _Ty > make_optional (_Types &&..._Args)
 
template<class _Ty , class _Elem , class... _Types>
constexpr optional< _Ty > make_optional (initializer_list< _Elem > _Ilist, _Types &&..._Args)
 

Variables

constexpr nullopt_t nullopt {nullopt_t::_Tag{}}
 

Macro Definition Documentation

#define _OPTIONAL_

Function Documentation

template<class _Ty >
class __declspec ( empty_bases  )
227  { // optional for object types
228 public:
229  static_assert(!is_reference<_Ty>::value,
230  "T in optional<T> cannot be a reference type (N4606 [optional.syn]/1).");
231  static_assert(!is_same<remove_cv_t<_Ty>, nullopt_t>::value,
232  "T in optional<T> cannot be nullopt_t (N4606 [optional.syn]/1).");
233  static_assert(!is_same<remove_cv_t<_Ty>, in_place_t>::value,
234  "T in optional<T> cannot be in_place_t (N4606 [optional.syn]/1).");
236  "T in optional<T> must be an object type (N4606 [optional.object]/3).");
238  "T in optional<T> must satisfy the requirements of Destructible (N4606 [optional.object]/3).");
239 
240  using value_type = _Ty;
241 
242  // constructors [optional.object.ctor]
243  constexpr optional() _NOEXCEPT
244  : _Optional_copymove_base<_Ty>{}
245  { // initialize to empty state
246  }
247  constexpr optional(nullopt_t) _NOEXCEPT
248  : _Optional_copymove_base<_Ty>{}
249  { // initialize to empty state
250  }
251 
252  template<class... _Types,
253  class = enable_if_t<is_constructible<_Ty, _Types...>::value>>
254  constexpr explicit optional(in_place_t, _Types&&... _Args)
255  : _Optional_copymove_base<_Ty>(in_place, _STD forward<_Types>(_Args)...)
256  { // initialize contained value from _Args...
257  }
258 
259  template<class _Elem,
260  class... _Types,
262  constexpr explicit optional(in_place_t, initializer_list<_Elem> _Ilist, _Types&&... _Args)
263  : _Optional_copymove_base<_Ty>(in_place, _Ilist, _STD forward<_Types>(_Args)...)
264  { // initialize contained value from _Ilist and _Args...
265  }
266 
267  template<class _Ty2>
268  using _AllowDirectConversion = bool_constant<
272  template<class _Ty2 = _Ty,
274  constexpr optional(_Ty2&& _Right)
275  : _Optional_copymove_base<_Ty>(in_place, _STD forward<_Ty2>(_Right))
276  { // initialize contained value from _Right
277  }
278  template<class _Ty2 = _Ty,
279  enable_if_t<conjunction<_AllowDirectConversion<_Ty2>, negation<is_convertible<_Ty2, _Ty>>>::value, int> = 0>
280  constexpr explicit optional(_Ty2&& _Right)
281  : _Optional_copymove_base<_Ty>(in_place, _STD forward<_Ty2>(_Right))
282  { // initialize contained value from _Right
283  }
284 
285  template<class _Ty2>
286  struct _AllowUnwrapping
287  : bool_constant<
288  !(is_constructible_v<_Ty, optional<_Ty2>&>
289  || is_constructible_v<_Ty, const optional<_Ty2>&>
290  || is_constructible_v<_Ty, const optional<_Ty2>>
291  || is_constructible_v<_Ty, optional<_Ty2>>
292  || is_convertible_v<optional<_Ty2>&, _Ty>
293  || is_convertible_v<const optional<_Ty2>&, _Ty>
294  || is_convertible_v<const optional<_Ty2>, _Ty>
295  || is_convertible_v<optional<_Ty2>, _Ty>)>
296  {};
297 
298  template<class _Ty2,
301  _AllowUnwrapping<_Ty2>,
302  is_convertible<const _Ty2&, _Ty>>::value, int> = 0>
303  optional(const optional<_Ty2>& _Right)
304  { // possibly initialize contained value from _Right
305  if (_Right)
306  {
307  this->_Construct(*_Right);
308  }
309  }
310  template<class _Ty2,
312  is_constructible<_Ty, const _Ty2&>,
313  _AllowUnwrapping<_Ty2>,
315  explicit optional(const optional<_Ty2>& _Right)
316  { // possibly initialize contained value from _Right
317  if (_Right)
318  {
319  this->_Construct(*_Right);
320  }
321  }
322 
323  template<class _Ty2,
326  _AllowUnwrapping<_Ty2>,
327  is_convertible<_Ty2, _Ty>>::value, int> = 0>
328  optional(optional<_Ty2>&& _Right)
329  { // possibly initialize contained value from _Right
330  if (_Right)
331  {
332  this->_Construct(_STD move(*_Right));
333  }
334  }
335  template<class _Ty2,
337  is_constructible<_Ty, _Ty2>,
338  _AllowUnwrapping<_Ty2>,
339  negation<is_convertible<_Ty2, _Ty>>>::value, int> = 0>
340  explicit optional(optional<_Ty2>&& _Right)
341  { // possibly initialize contained value from _Right
342  if (_Right)
343  {
344  this->_Construct(_STD move(*_Right));
345  }
346  }
347 
348  // assignment [optional.object.assign]
349  optional& operator=(nullopt_t) _NOEXCEPT
350  { // destroy any contained value and transition to empty state
351  reset();
352  return (*this);
353  }
354 
355  template<class _Ty2 = _Ty,
356  class = enable_if_t<conjunction<
360  is_constructible<_Ty, _Ty2>,
361  is_assignable<_Ty&, _Ty2>>::value>>
362  optional& operator=(_Ty2&& _Right)
363  { // assign/initialize contained value from _Right
364  this->_Assign(_STD forward<_Ty2>(_Right));
365  return (*this);
366  }
367 
368  template<class _Ty2>
369  struct _AllowUnwrappingAssignment
370  : bool_constant<
371  !(is_assignable_v<_Ty&, optional<_Ty2>&>
372  || is_assignable_v<_Ty&, const optional<_Ty2>&>
373  || is_assignable_v<_Ty&, const optional<_Ty2>>
374  || is_assignable_v<_Ty&, optional<_Ty2>>)>
375  {};
376 
377  template<class _Ty2,
378  class = enable_if_t<conjunction<
379  is_constructible<_Ty, const _Ty2&>,
381  _AllowUnwrappingAssignment<_Ty2>>::value>>
382  optional& operator=(const optional<_Ty2>& _Right)
383  { // assign/initialize/destroy contained value from _Right
384  if (_Right)
385  {
386  this->_Assign(*_Right);
387  }
388  else
389  {
390  reset();
391  }
392  return (*this);
393  }
394 
395  template<class _Ty2,
396  class = enable_if_t<conjunction<
397  is_constructible<_Ty, _Ty2>,
399  _AllowUnwrappingAssignment<_Ty2>>::value>>
400  optional& operator=(optional<_Ty2>&& _Right)
401  { // assign/initialize/destroy contained value from _Right
402  if (_Right)
403  {
404  this->_Assign(_STD move(*_Right));
405  }
406  else
407  {
408  reset();
409  }
410  return (*this);
411  }
412 
413  template<class... _Types>
414  void emplace(_Types&&... _Args)
415  { // destroy any contained value, then initialize from _Args...
416  reset();
417  this->_Construct(_STD forward<_Types>(_Args)...);
418  }
419 
420  template<class _Elem,
421  class... _Types,
423  _Ty, initializer_list<_Elem>&, _Types...>::value>>
424  void emplace(initializer_list<_Elem> _Ilist, _Types&&... _Args)
425  { // destroy any contained value, then initialize from _Ilist and _Args...
426  reset();
427  this->_Construct(_Ilist, _STD forward<_Types>(_Args)...);
428  }
429 
430  // swap [optional.object.swap]
431  void swap(optional& _Right)
432  _NOEXCEPT_OP(is_nothrow_move_constructible<_Ty>::value && is_nothrow_swappable<_Ty>::value)
433  { // exchange state with _Right
434  static_assert(is_move_constructible<_Ty>::value,
435  "optional<T>::swap requires T to be move constructible (N4606 [optional.object.swap]/1).");
436  static_assert(is_swappable<_Ty>::value,
437  "optional<T>::swap requires T to be swappable (N4606 [optional.object.swap]/1).");
438  const bool _Engaged = has_value();
439  if (_Engaged == _Right.has_value())
440  {
441  if (_Engaged)
442  {
443  _Swap_adl(**this, *_Right);
444  }
445  }
446  else
447  {
448  optional& _Source = *this ? *this : _Right;
449  optional& _Target = *this ? _Right : *this;
450  _Target._Construct(_STD move(*_Source));
451  _Source.reset();
452  }
453  }
454 
455  // observers [optional.object.observe]
456  constexpr const _Ty * operator->() const
457  { // return pointer to contained value
458  return (_STD addressof(this->_Value));
459  }
460  _CONSTEXPR14 _Ty * operator->()
461  { // return pointer to contained value
462  return (_STD addressof(this->_Value));
463  }
464 
465  constexpr const _Ty& operator*() const &
466  { // return reference to contained value
467  return (this->_Value);
468  }
469  _CONSTEXPR14 _Ty& operator*() &
470  { // return reference to contained value
471  return (this->_Value);
472  }
473  _CONSTEXPR14 _Ty&& operator*() &&
474  { // return reference to contained value
475  return (_STD move(this->_Value));
476  }
477  constexpr const _Ty&& operator*() const &&
478  { // return reference to contained value
479  return (_STD move(this->_Value));
480  }
481 
482  constexpr explicit operator bool() const _NOEXCEPT
483  { // return true iff *this contains a value
484  return (this->_Has_value);
485  }
486  constexpr bool has_value() const _NOEXCEPT
487  { // return true iff *this contains a value
488  return (this->_Has_value);
489  }
490 
491  constexpr const _Ty& value() const &
492  { // return reference to contained value or throw if none
493  return ((void)(has_value() || (_THROW_NCEE(bad_optional_access, _EMPTY_ARGUMENT), true)), **this);
494  }
495  _CONSTEXPR14 _Ty& value() &
496  { // return reference to contained value or throw if none
497  return ((void)(has_value() || (_THROW_NCEE(bad_optional_access, _EMPTY_ARGUMENT), true)), **this);
498  }
499  _CONSTEXPR14 _Ty&& value() &&
500  { // return reference to contained value or throw if none
501  return ((void)(has_value() || (_THROW_NCEE(bad_optional_access, _EMPTY_ARGUMENT), true)), _STD move(**this));
502  }
503  constexpr const _Ty&& value() const &&
504  { // return reference to contained value or throw if none
505  return ((void)(has_value() || (_THROW_NCEE(bad_optional_access, _EMPTY_ARGUMENT), true)), _STD move(**this));
506  }
507 
508  template<class _Ty2>
509  constexpr _Ty value_or(_Ty2&& _Right) const &
510  { // return contained value or _Right if none
511  static_assert(is_copy_constructible<_Ty>::value,
512  "The const overload of optional<T>::value_or requires T to be copy constructible "
513  "(N4606 [optional.object.observe]).");
514  static_assert(is_convertible<_Ty2, _Ty>::value,
515  "optional<T>::value_or(U) requires U to be convertible to T (N4606 [optional.object.observe]).");
516  return (*this ? **this : static_cast<_Ty>(_STD forward<_Ty2>(_Right)));
517  }
518  template<class _Ty2>
519  _CONSTEXPR14 _Ty value_or(_Ty2&& _Right) &&
520  { // return contained value or _Right if none
521  static_assert(is_move_constructible<_Ty>::value,
522  "The rvalue overload of optional<T>::value_or requires T to be move constructible "
523  "(N4606 [optional.object.observe]).");
524  static_assert(is_convertible<_Ty2, _Ty>::value,
525  "optional<T>::value_or(U) requires U to be convertible to T (N4606 [optional.object.observe]).");
526  return (*this ? _STD move(**this) : static_cast<_Ty>(_STD forward<_Ty2>(_Right)));
527  }
528 
529  // modifiers [optional.object.mod]
531  };
#define _CONSTEXPR14
Definition: yvals.h:114
_Variant_copymove_layer_ & operator=(_Variant_copymove_layer_ &&_That) _NOEXCEPT_OP((conjunction< is_nothrow_move_constructible< _Types >...
Definition: type_traits:270
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
Definition: type_traits:591
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator*(const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
Definition: amp.h:890
Definition: type_traits:598
#define _NOEXCEPT
Definition: yvals.h:84
Definition: type_traits:580
Definition: optional:35
Definition: type_traits:415
#define _NOEXCEPT_OP(x)
Definition: yvals.h:85
Definition: xsmf_control.h:35
Definition: optional:27
Definition: xsmf_control.h:19
_Source
Definition: corecrt_wstring.h:187
Definition: type_traits:1171
Definition: optional:156
#define bool
Definition: stdbool.h:15
Definition: type_traits:404
#define _THROW_NCEE(x, y)
Definition: xstddef:51
Definition: type_traits:554
Definition: type_traits:620
Definition: type_traits:561
Definition: initializer_list:17
Definition: type_traits:444
Definition: type_traits:610
Definition: xsmf_control.h:67
#define _EMPTY_ARGUMENT
Definition: xstddef:77
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:73
_In_ _Value
Definition: corecrt_wstdlib.h:65
constexpr _Ty && forward(typename remove_reference< _Ty >::type &_Arg) _NOEXCEPT
Definition: type_traits:1332
Definition: type_traits:732
typename enable_if< _Test, _Ty >::type enable_if_t
Definition: type_traits:2099
typename remove_cv< _Ty >::type remove_cv_t
Definition: type_traits:2048
void swap(optional< _Ty > &_Left, optional< _Ty > &_Right) _NOEXCEPT_OP(_NOEXCEPT_OP(_Left.swap(_Right)))
Definition: optional:702
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
Definition: xtr1common:87
const void * _Target(const type_info &_Info) const _NOEXCEPT
Definition: functional:408
Definition: xsmf_control.h:51
Definition: type_traits:315
constexpr const _Ty &() _Right
Definition: algorithm:3723
Definition: type_traits:1110
template<class _Ty >
constexpr optional<decay_t<_Ty> > make_optional ( _Ty &&  _Value)
711  { // Construct an optional from _Value
712  return (optional<decay_t<_Ty>>{_STD forward<_Ty>(_Value)});
713  }
typename decay< _Ty >::type decay_t
Definition: type_traits:2095
_In_ _Value
Definition: corecrt_wstdlib.h:65
template<class _Ty , class... _Types>
constexpr optional<_Ty> make_optional ( _Types &&...  _Args)
717  { // Construct an optional from _Args
718  return (optional<_Ty>{in_place, _STD forward<_Types>(_Args)...});
719  }
template<class _Ty , class _Elem , class... _Types>
constexpr optional<_Ty> make_optional ( initializer_list< _Elem >  _Ilist,
_Types &&...  _Args 
)
724  { // Construct an optional from _Ilist and _Args
725  return (optional<_Ty>{in_place, _Ilist, _STD forward<_Types>(_Args)...});
726  }
template<class _Ty >
constexpr bool operator!= ( const optional< _Ty > &  _Left,
const optional< _Ty > &  _Right 
)
541  {
542  return (_Left.has_value() != _Right.has_value() || (_Left && *_Left != *_Right));
543  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator!= ( const optional< _Ty > &  _Left,
nullopt_t   
)
579  {
580  return (_Left.has_value());
581  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
template<class _Ty >
constexpr bool operator!= ( nullopt_t  ,
const optional< _Ty > &  _Right 
)
584  {
585  return (_Right.has_value());
586  }
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator!= ( const optional< _Ty > &  _Left,
const _Ty &  _Right 
)
646  {
647  return (_Left ? *_Left != _Right : true);
648  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator!= ( const _Ty &  _Left,
const optional< _Ty > &  _Right 
)
651  {
652  return (_Right ? _Left != *_Right : true);
653  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator< ( const optional< _Ty > &  _Left,
const optional< _Ty > &  _Right 
)
546  {
547  return (_Right && (!_Left || *_Left < *_Right));
548  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator< ( const optional< _Ty > &  ,
nullopt_t   
)
590  {
591  return (false);
592  }
template<class _Ty >
constexpr bool operator< ( nullopt_t  ,
const optional< _Ty > &  _Right 
)
595  {
596  return (_Right.has_value());
597  }
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator< ( const optional< _Ty > &  _Left,
const _Ty &  _Right 
)
657  {
658  return (_Left ? *_Left < _Right : true);
659  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator< ( const _Ty &  _Left,
const optional< _Ty > &  _Right 
)
662  {
663  return (_Right ? _Left < *_Right : false);
664  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator<= ( const optional< _Ty > &  _Left,
const optional< _Ty > &  _Right 
)
556  {
557  return (!_Left || (_Right && *_Left <= *_Right));
558  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator<= ( const optional< _Ty > &  _Left,
nullopt_t   
)
601  {
602  return (!_Left.has_value());
603  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
template<class _Ty >
constexpr bool operator<= ( nullopt_t  ,
const optional< _Ty > &   
)
606  {
607  return (true);
608  }
template<class _Ty >
constexpr bool operator<= ( const optional< _Ty > &  _Left,
const _Ty &  _Right 
)
668  {
669  return (_Left ? *_Left <= _Right : true);
670  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator<= ( const _Ty &  _Left,
const optional< _Ty > &  _Right 
)
673  {
674  return (_Right ? _Left <= *_Right : false);
675  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator== ( const optional< _Ty > &  _Left,
const optional< _Ty > &  _Right 
)
536  {
537  return (_Left.has_value() == _Right.has_value() && (!_Left || *_Left == *_Right));
538  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator== ( const optional< _Ty > &  _Left,
nullopt_t   
)
568  {
569  return (!_Left.has_value());
570  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
template<class _Ty >
constexpr bool operator== ( nullopt_t  ,
const optional< _Ty > &  _Right 
)
573  {
574  return (!_Right.has_value());
575  }
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator== ( const optional< _Ty > &  _Left,
const _Ty &  _Right 
)
635  {
636  return (_Left ? *_Left == _Right : false);
637  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator== ( const _Ty &  _Left,
const optional< _Ty > &  _Right 
)
640  {
641  return (_Right ? _Left == *_Right : false);
642  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator> ( const optional< _Ty > &  _Left,
const optional< _Ty > &  _Right 
)
551  {
552  return (_Left && (!_Right || *_Left > *_Right));
553  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator> ( const optional< _Ty > &  _Left,
nullopt_t   
)
612  {
613  return (_Left.has_value());
614  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
template<class _Ty >
constexpr bool operator> ( nullopt_t  ,
const optional< _Ty > &   
)
617  {
618  return (false);
619  }
template<class _Ty >
constexpr bool operator> ( const optional< _Ty > &  _Left,
const _Ty &  _Right 
)
679  {
680  return (_Left ? *_Left > _Right : false);
681  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator> ( const _Ty &  _Left,
const optional< _Ty > &  _Right 
)
684  {
685  return (_Right ? _Left > *_Right : true);
686  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator>= ( const optional< _Ty > &  _Left,
const optional< _Ty > &  _Right 
)
561  {
562  return (!_Right || (_Left && *_Left >= *_Right));
563  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator>= ( const optional< _Ty > &  ,
nullopt_t   
)
623  {
624  return (true);
625  }
template<class _Ty >
constexpr bool operator>= ( nullopt_t  ,
const optional< _Ty > &  _Right 
)
628  {
629  return (!_Right.has_value());
630  }
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator>= ( const optional< _Ty > &  _Left,
const _Ty &  _Right 
)
690  {
691  return (_Left ? *_Left >= _Right : false);
692  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty >
constexpr bool operator>= ( const _Ty &  _Left,
const optional< _Ty > &  _Right 
)
695  {
696  return (_Right ? _Left >= *_Right : true);
697  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty , class = enable_if_t<is_move_constructible<_Ty>::value && is_swappable<_Ty>::value>>
void swap ( optional< _Ty > &  _Left,
optional< _Ty > &  _Right 
)
inline
704  { // exchange the values of _Left and _Right
705  _Left.swap(_Right);
706  }
constexpr const _Ty &() _Left
Definition: algorithm:3722
constexpr const _Ty &() _Right
Definition: algorithm:3723

Variable Documentation

constexpr nullopt_t nullopt {nullopt_t::_Tag{}}