36 template <
typename... Args>
40 res.
emplace(std::forward<Args>(args)...);
61 m_value = std::move(other.m_value);
66 m_value = std::move(other.m_value);
82 bool operator<(const TTKOptional<T> &other)
const
87 bool operator<=(const TTKOptional<T> &other)
const
102 template <
typename... Args>
105 m_value = std::make_unique<T>(std::forward<Args>(args)...);
112 operator bool()
const {
return m_value.operator bool(); }
143 template <
typename T>
146 return v.
has_value() ? (*v == other) :
false;
149 template <
typename T>
152 return v.
has_value() ? (*v == other) :
false;
155 template <
typename T>
161 template <
typename T>
172 template <
typename T>
177 #endif // TTKOPTIONAL_H
void emplace(Args &&...args)
TTKOptional(const TTKOptional< T > &other, typename std::enable_if< std::is_copy_constructible< T >::value, int >::type=0)
void operator=(const TTKOptional< T > &other)
TTKOptional & operator=(TTKOptional &&other)
const T * operator->() const
bool operator==(const TTKOptional< T > &v, const T &other)
bool operator!=(const TTKOptional &other) const
_MakeUnique< _Tp >::__single_object make_unique(_Args &&...__args)
std::make_unique for single objects
TTKOptional(const T &other)
const T & operator*() const
TTKOptional(TTKOptional &&other)
bool operator!=(const TTKOptional< T > &v, const T &other)
bool operator>(const TTKOptional< T > &other) const
static TTKOptional< T > make_optional(Args &&...args)
std::unique_ptr< T > m_value
bool operator>=(const TTKOptional< T > &other) const
The class of the optional module.
bool operator==(const TTKOptional &other) const