10 #include <type_traits> 41 #define CONSTRUCT_IN_PLACE armnn::ConstructInPlace{} 61 explicit operator bool() const noexcept
68 : m_HasValue{hasValue}
80 template <
bool IsReference,
typename T>
95 template<
class... Args>
120 Construct(other.
value());
139 if (Base::has_value())
142 Base::m_HasValue =
false;
148 if (!Base::has_value())
153 auto valuePtr =
reinterpret_cast<const T*
>(m_Storage);
159 if (!Base::has_value())
164 auto valuePtr =
reinterpret_cast<T*
>(m_Storage);
169 void Construct(
const T& value)
171 new (m_Storage) T(value);
175 template<
class... Args>
178 new (m_Storage) T(std::forward<Args>(args)...);
182 alignas(
alignof(T))
unsigned char m_Storage[
sizeof(T)];
190 template <
typename T>
195 using NonRefT =
typename std::remove_reference<T>::type;
211 template<
class... Args>
217 Base::m_HasValue =
true;
223 m_Storage = other.m_Storage;
241 Base::m_HasValue =
false;
247 if (!Base::has_value())
257 if (!Base::has_value())
269 template <
typename T>
281 template<
class... Args>
289 if (!this->has_value() && !rhs.
has_value())
293 if (this->has_value() && rhs.
has_value() && this->value() == rhs.
value())
303 template<
typename T,
class... Args>
OptionalBase(bool hasValue) noexcept
Optional(ConstructInPlace, Args &&... args)
~OptionalReferenceSwitch()
#define CONSTRUCT_IN_PLACE
OptionalReferenceSwitch & operator=(const T value)
OptionalReferenceSwitch(const T &value)
OptionalReferenceSwitch(const OptionalReferenceSwitch &other)
~OptionalReferenceSwitch()
OptionalReferenceSwitch(ConstructInPlace, Args &&... args)
DataLayout::NCHW DataLayout::NCHW DataLayout::NHWC DataLayout::NHWC true
OptionalReferenceSwitch & operator=(EmptyOptional)
OptionalReferenceSwitch & operator=(EmptyOptional)
OptionalReferenceSwitch(EmptyOptional) noexcept
OptionalReferenceSwitch(T value)
OptionalReferenceSwitch() noexcept
OptionalReferenceSwitch(EmptyOptional) noexcept
Optional(EmptyOptional empty)
Optional(const Optional &other)
typename std::remove_reference< T >::type NonRefT
Optional(const BaseSwitch &other)
bool operator==(const Optional< T > &rhs) const
Optional< T > MakeOptional(Args &&... args)
OptionalReferenceSwitch(const OptionalReferenceSwitch &other)
OptionalReferenceSwitch & operator=(const T &value)
OptionalReferenceSwitch & operator=(const OptionalReferenceSwitch &other)
OptionalReferenceSwitch() noexcept
OptionalReferenceSwitch & operator=(const OptionalReferenceSwitch &other)
bool has_value() const noexcept