20 #ifndef GDB_OPTIONAL_H 21 #define GDB_OPTIONAL_H 59 template<
typename... Args>
61 :
m_item (std::forward<Args> (args)...),
77 noexcept(std::is_nothrow_move_constructible<T> ())
79 if (other.m_instantiated)
80 this->
emplace (std::move (other.get ()));
89 noexcept (std::is_nothrow_move_constructible<T> ())
90 :
m_item (std::move (other)),
100 this->
get () = other.
get ();
114 noexcept (
And<std::is_nothrow_move_constructible<T>,
115 std::is_nothrow_move_assignable<T>> ())
118 this->
get () = std::move (other.get ());
121 if (other.m_instantiated)
122 this->
emplace (std::move (other.get ()));
133 this->
get () = other;
141 noexcept (
And<std::is_nothrow_move_constructible<T>,
142 std::is_nothrow_move_assignable<T>> ())
145 this->
get () = std::move (other);
147 this->
emplace (std::move (other));
151 template<
typename... Args>
155 new (&
m_item) T (std::forward<Args>(args)...);
162 {
return std::addressof (this->
get ()); }
165 {
return std::addressof (this->
get ()); }
168 {
return this->
get (); }
171 {
return this->
get (); }
174 {
return std::move (this->
get ()); }
177 {
return std::move (this->
get ()); }
179 constexpr
explicit operator bool () const noexcept
204 constexpr
const T &
get ()
const noexcept {
return m_item; }
constexpr optional(in_place_t, Args &&... args)
constexpr const T * operator->() const
constexpr optional(T &&other) noexcept(std::is_nothrow_move_constructible< T >())
struct gdb::optional::@25::@27 m_dummy
constexpr const T & operator*() const &
optional(const optional &other)
optional & operator=(const optional &other)
optional(optional &&other) noexcept(std::is_nothrow_move_constructible< T >())
T & emplace(Args &&... args)
constexpr bool has_value() const noexcept
constexpr optional(const T &other)