18 new (&m_storage) T(val);
19 m_value =
reinterpret_cast<T *
>(&m_storage);
24 new (&m_storage) T(std::forward<T>(val));
25 m_value =
reinterpret_cast<T *
>(&m_storage);
40 *m_value = std::forward<U>(u);
44 new (&m_storage) T(std::forward<U>(u));
45 m_value =
reinterpret_cast<T *
>(&m_storage);
54 new (&m_storage) T(*other.m_value);
55 m_value =
reinterpret_cast<T *
>(&m_storage);
67 new (&m_storage) T(std::forward<T>(*other.m_value));
68 m_value =
reinterpret_cast<T *
>(&m_storage);
87 *m_value = *other.m_value;
100 new (&m_storage) T(*other.m_value);
101 m_value =
reinterpret_cast<T *
>(&m_storage);
118 *m_value = *other.m_value;
131 new (&m_storage) T(*other.m_value);
132 m_value =
reinterpret_cast<T *
>(&m_storage);
149 *m_value = std::forward<U>(*other.m_value);
162 new (&m_storage) T(std::forward<U>(*other.m_value));
163 m_value =
reinterpret_cast<T *
>(&m_storage);
173 const T &&
operator*() const && {
return std::move(*m_value); }
176 explicit operator bool() const noexcept {
return m_value !=
nullptr; }
177 bool has_value() const noexcept {
return m_value !=
nullptr; }
180 const T &
value() const & {
return *m_value; }
182 T &&
value() && {
return std::move(*m_value); }
183 const T &&
value() const && {
return std::move(*m_value); }
186 typename std::aligned_storage<
sizeof(T)>::
type m_storage;
Definition: Optional.h:13
const T & operator*() const &
Definition: Optional.h:171
Optional(const T &val)
Definition: Optional.h:16
Optional & operator=(const Optional &other)
Definition: Optional.h:76
const T & value() const &
Definition: Optional.h:180
Optional()
Definition: Optional.h:15
bool has_value() const noexcept
Definition: Optional.h:177
Optional(const Optional< T > &other)
Definition: Optional.h:50
T && operator*() &&
Definition: Optional.h:174
const T && operator*() const &&
Definition: Optional.h:173
Optional(Optional< T > &&other)
Definition: Optional.h:63
Optional< T > & operator=(const Optional< U > &other)
Definition: Optional.h:107
Optional(T &&val)
Definition: Optional.h:22
T & operator*() &
Definition: Optional.h:172
Optional< T > & operator=(Optional< U > &&other)
Definition: Optional.h:138
T && value() &&
Definition: Optional.h:182
const T * operator->() const
Definition: Optional.h:169
Optional & operator=(U &&u)
Definition: Optional.h:36
T & value() &
Definition: Optional.h:179
~Optional()
Definition: Optional.h:28
T * operator->()
Definition: Optional.h:170
const T && value() const &&
Definition: Optional.h:183
newitem type
Definition: cJSON.cpp:2724