Lines Matching refs:optional
2 //===-------------------------- optional ----------------------------------===//
15 optional synopsis
20 // 23.6.3, optional for object types
21 template <class T> class optional;
32 constexpr bool operator==(const optional<T>&, const optional<U>&);
34 constexpr bool operator!=(const optional<T>&, const optional<U>&);
36 constexpr bool operator<(const optional<T>&, const optional<U>&);
38 constexpr bool operator>(const optional<T>&, const optional<U>&);
40 constexpr bool operator<=(const optional<T>&, const optional<U>&);
42 constexpr bool operator>=(const optional<T>&, const optional<U>&);
45 template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
46 template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
47 template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
48 template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
49 template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
50 template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
51 template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
52 template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
53 template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
54 template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
55 template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
56 template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
59 template <class T, class U> constexpr bool operator==(const optional<T>&, const U&);
60 template <class T, class U> constexpr bool operator==(const T&, const optional<U>&);
61 template <class T, class U> constexpr bool operator!=(const optional<T>&, const U&);
62 template <class T, class U> constexpr bool operator!=(const T&, const optional<U>&);
63 template <class T, class U> constexpr bool operator<(const optional<T>&, const U&);
64 template <class T, class U> constexpr bool operator<(const T&, const optional<U>&);
65 template <class T, class U> constexpr bool operator<=(const optional<T>&, const U&);
66 template <class T, class U> constexpr bool operator<=(const T&, const optional<U>&);
67 template <class T, class U> constexpr bool operator>(const optional<T>&, const U&);
68 template <class T, class U> constexpr bool operator>(const T&, const optional<U>&);
69 template <class T, class U> constexpr bool operator>=(const optional<T>&, const U&);
70 template <class T, class U> constexpr bool operator>=(const T&, const optional<U>&);
73 template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below );
74 template <class T> constexpr optional<see below > make_optional(T&&);
76 constexpr optional<T> make_optional(Args&&... args);
78 constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
82 template <class T> struct hash<optional<T>>;
84 template <class T> class optional {
89 constexpr optional() noexcept;
90 constexpr optional(nullopt_t) noexcept;
91 optional(const optional &);
92 optional(optional &&) noexcept(see below);
93 template <class... Args> constexpr explicit optional(in_place_t, Args &&...);
95 constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...);
97 constexpr EXPLICIT optional(U &&);
99 constexpr EXPLICIT optional(const optional<U> &);
101 constexpr EXPLICIT optional(optional<U> &&);
104 ~optional();
107 optional &operator=(nullopt_t) noexcept;
108 optional &operator=(const optional &); // constexpr in C++20
109 optional &operator=(optional &&) noexcept(see below); // constexpr in C++20
110 template <class U = T> optional &operator=(U &&);
111 template <class U> optional &operator=(const optional<U> &);
112 template <class U> optional &operator=(optional<U> &&);
118 void swap(optional &) noexcept(see below );
144 optional(T) -> optional<T>;
214 "instantiation of optional with a non-object type is undefined behavior");
256 "instantiation of optional with a non-object type is undefined behavior");
355 // optional<T&> is currently required ill-formed, however it may to be in the
585 class optional
597 "instantiation of optional with in_place_t is ill-formed");
599 "instantiation of optional with nullopt_t is ill-formed");
601 "instantiation of optional with a reference type is ill-formed");
603 "instantiation of optional with a non-destructible type is ill-formed");
622 !is_same_v<__uncvref_t<_Up>, optional>,
628 template <class _Up, class _Opt = optional<_Up>>
639 template <class _Up, class _Opt = optional<_Up>>
686 _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
687 _LIBCPP_INLINE_VISIBILITY constexpr optional(const optional&) = default;
688 _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default;
689 _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
695 constexpr explicit optional(in_place_t, _Args&&... __args)
702 constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
709 constexpr optional(_Up&& __v)
716 constexpr explicit optional(_Up&& __v)
719 // LWG2756: conditionally explicit conversion from const optional<_Up>&
724 optional(const optional<_Up>& __v)
732 explicit optional(const optional<_Up>& __v)
737 // LWG2756: conditionally explicit conversion from optional<_Up>&&
742 optional(optional<_Up>&& __v)
750 explicit optional(optional<_Up>&& __v)
756 optional& operator=(nullopt_t) noexcept
762 _LIBCPP_INLINE_VISIBILITY optional& operator=(const optional&) = default;
763 _LIBCPP_INLINE_VISIBILITY optional& operator=(optional&&) = default;
770 !is_same_v<__uncvref_t<_Up>, optional> &&
778 optional&
793 optional&
794 operator=(const optional<_Up>& __v)
805 optional&
806 operator=(optional<_Up>&& __v)
843 void swap(optional& __opt)
873 _LIBCPP_ASSERT(this->has_value(), "optional operator-> called for disengaged value");
886 _LIBCPP_ASSERT(this->has_value(), "optional operator-> called for disengaged value");
899 _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
908 _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
917 _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
926 _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
977 "optional<T>::value_or: T must be copy constructible");
979 "optional<T>::value_or: U must be convertible to T");
989 "optional<T>::value_or: T must be move constructible");
991 "optional<T>::value_or: U must be convertible to T");
1018 optional(T) -> optional<T>;
1029 operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
1045 operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
1061 operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
1077 operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
1093 operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
1109 operator>=(const optional<_Tp>& __x, const optional<_Up>& __y)
1122 operator==(const optional<_Tp>& __x, nullopt_t) noexcept
1130 operator==(nullopt_t, const optional<_Tp>& __x) noexcept
1138 operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
1146 operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
1154 operator<(const optional<_Tp>&, nullopt_t) noexcept
1162 operator<(nullopt_t, const optional<_Tp>& __x) noexcept
1170 operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
1178 operator<=(nullopt_t, const optional<_Tp>&) noexcept
1186 operator>(const optional<_Tp>& __x, nullopt_t) noexcept
1194 operator>(nullopt_t, const optional<_Tp>&) noexcept
1202 operator>=(const optional<_Tp>&, nullopt_t) noexcept
1210 operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
1223 operator==(const optional<_Tp>& __x, const _Up& __v)
1235 operator==(const _Tp& __v, const optional<_Up>& __x)
1247 operator!=(const optional<_Tp>& __x, const _Up& __v)
1259 operator!=(const _Tp& __v, const optional<_Up>& __x)
1271 operator<(const optional<_Tp>& __x, const _Up& __v)
1283 operator<(const _Tp& __v, const optional<_Up>& __x)
1295 operator<=(const optional<_Tp>& __x, const _Up& __v)
1307 operator<=(const _Tp& __v, const optional<_Up>& __x)
1319 operator>(const optional<_Tp>& __x, const _Up& __v)
1331 operator>(const _Tp& __v, const optional<_Up>& __x)
1343 operator>=(const optional<_Tp>& __x, const _Up& __v)
1355 operator>=(const _Tp& __v, const optional<_Up>& __x)
1367 swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
1374 optional<decay_t<_Tp>> make_optional(_Tp&& __v)
1376 return optional<decay_t<_Tp>>(_VSTD::forward<_Tp>(__v));
1381 optional<_Tp> make_optional(_Args&&... __args)
1383 return optional<_Tp>(in_place, _VSTD::forward<_Args>(__args)...);
1388 optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args)
1390 return optional<_Tp>(in_place, __il, _VSTD::forward<_Args>(__args)...);
1395 __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>>
1398 typedef optional<_Tp> argument_type;