AWS IoT Device SDK C++ v2
1.36.0
AWS IoT Device SDK C++ v2
|
Go to the documentation of this file.
26 new (m_storage) T(val);
27 m_value =
reinterpret_cast<T *
>(m_storage);
32 new (m_storage) T(std::forward<T>(val));
33 m_value =
reinterpret_cast<T *
>(m_storage);
49 typename std::enable_if<
56 *m_value = std::forward<U>(u);
60 new (m_storage) T(std::forward<U>(u));
61 m_value =
reinterpret_cast<T *
>(m_storage);
70 new (m_storage) T(*other.m_value);
71 m_value =
reinterpret_cast<T *
>(m_storage);
83 new (m_storage) T(std::forward<T>(*other.m_value));
84 m_value =
reinterpret_cast<T *
>(m_storage);
94 new (m_storage) T(std::forward<Args>(args)...);
95 m_value =
reinterpret_cast<T *
>(m_storage);
104 template <
typename... Args> T &
emplace(Args &&...args)
108 new (m_storage) T(std::forward<Args>(args)...);
109 m_value =
reinterpret_cast<T *
>(m_storage);
118 const T &&
operator*() const && {
return std::move(*m_value); }
121 explicit operator bool() const noexcept {
return m_value !=
nullptr; }
122 bool has_value() const noexcept {
return m_value !=
nullptr; }
125 const T &
value() const & {
return *m_value; }
127 T &&
value() && {
return std::move(*m_value); }
128 const T &&
value() const && {
return std::move(*m_value); }
140 template <
typename Op>
Optional &assign(Op &&other)
145 using U =
typename std::conditional<
146 std::is_const<typename std::remove_reference<Op>::type>
::value,
147 const typename std::decay<Op>::type::ValueType &,
148 typename std::decay<Op>::type::ValueType>::type;
150 if ((
void *)
this == (
void *)&other)
159 if (other.has_value())
161 *m_value = std::forward<U>(other.value());
172 if (other.has_value())
174 new (m_storage) T(std::forward<U>(other.value()));
175 m_value =
reinterpret_cast<T *
>(m_storage);
181 alignas(T)
char m_storage[
sizeof(T)];
const T && operator*() const &&
Definition: Optional.h:118
Optional(const T &val)
Definition: Optional.h:24
T & emplace(Args &&...args)
Definition: Optional.h:104
const T & operator*() const &
Definition: Optional.h:116
Optional(T &&val)
Definition: Optional.h:30
Optional< T > & operator=(Optional< U > &&other)
Definition: Optional.h:102
bool has_value() const noexcept
Definition: Optional.h:122
Definition: Optional.h:19
T & value() &
Definition: Optional.h:124
~Optional()
Definition: Optional.h:36
Definition: DateTime.h:53
Definition: Allocator.h:11
Optional & operator=(U &&u)
Definition: Optional.h:52
T & operator*() &
Definition: Optional.h:117
const T & value() const &
Definition: Optional.h:125
Optional< T > & operator=(const Optional &other)
Definition: Optional.h:98
Optional< T > & operator=(const Optional< U > &other)
Definition: Optional.h:100
const T && value() const &&
Definition: Optional.h:128
T && operator*() &&
Definition: Optional.h:119
T && value() &&
Definition: Optional.h:127
Optional(Optional< T > &&other)
Definition: Optional.h:79
Optional()
Definition: Optional.h:23
Optional(const Optional< T > &other)
Definition: Optional.h:66
Definition: TypeTraits.h:20
T * operator->()
Definition: Optional.h:115
const T * operator->() const
Definition: Optional.h:114
void reset()
Definition: Optional.h:130
Optional(Aws::Crt::InPlaceT, Args &&...args)
Definition: Optional.h:92