10 #include <type_traits>
41 #define CONSTRUCT_IN_PLACE armnn::ConstructInPlace{}
61 explicit operator bool() const noexcept
80 template <
bool IsReference,
typename T>
95 template<
class... Args>
120 Construct(other.
value());
153 auto valuePtr =
reinterpret_cast<const T*
>(m_Storage);
164 auto valuePtr =
reinterpret_cast<T*
>(m_Storage);
169 void Construct(
const T&
value)
171 new (m_Storage) T(
value);
175 template<
class... Args>
176 void Construct(ConstructInPlace, Args&&... 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>
223 m_Storage = other.m_Storage;
269 template <
typename T>
282 template<
class... Args>
304 template<
typename T,
class... Args>
#define CONSTRUCT_IN_PLACE
OptionalBase is the common functionality between reference and non-reference optional types.
OptionalBase(bool hasValue) noexcept
bool has_value() const noexcept
Optional & operator=(const Optional &other)=default
Optional(ConstructInPlace, Args &&... args)
Optional(EmptyOptional empty)
bool operator==(const Optional< T > &rhs) const
Two optionals are considered equal if they are both empty or both contain values which themselves are...
Optional(const Optional &other)
Optional(const BaseSwitch &other)
OptionalReferenceSwitch & operator=(const T value)
OptionalReferenceSwitch(EmptyOptional) noexcept
OptionalReferenceSwitch(ConstructInPlace, Args &&... args)=delete
OptionalReferenceSwitch(const OptionalReferenceSwitch &other)
OptionalReferenceSwitch(T value)
typename std::remove_reference< T >::type NonRefT
~OptionalReferenceSwitch()
OptionalReferenceSwitch() noexcept
OptionalReferenceSwitch & operator=(const OptionalReferenceSwitch &other)
OptionalReferenceSwitch & operator=(EmptyOptional)
The default implementation is the non-reference case.
OptionalReferenceSwitch(EmptyOptional) noexcept
OptionalReferenceSwitch(ConstructInPlace, Args &&... args)
OptionalReferenceSwitch(const OptionalReferenceSwitch &other)
OptionalReferenceSwitch(const T &value)
OptionalReferenceSwitch & operator=(const T &value)
~OptionalReferenceSwitch()
OptionalReferenceSwitch() noexcept
OptionalReferenceSwitch & operator=(const OptionalReferenceSwitch &other)
OptionalReferenceSwitch & operator=(EmptyOptional)
Copyright (c) 2021 ARM Limited and Contributors.
Optional< T > MakeOptional(Args &&... args)
Utility template that constructs an object of type T in-place and wraps it inside an Optional<T> obje...
Disambiguation tag that can be passed to the constructor to indicate that the contained object should...
ConstructInPlace()=default
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...