14#ifndef IOX2_BB_VOCABULARY_EXPECTED_HELPER_HPP
15#define IOX2_BB_VOCABULARY_EXPECTED_HELPER_HPP
49template <
typename T =
void>
58 template <
typename U = T,
typename = enable_if_not_lvalue_referece_t<U>>
61 :
value(std::forward<T>(
t)) {
65 template <
typename...
Targs>
90 template <
typename U = T,
typename = enable_if_not_lvalue_referece_t<U>>
93 :
value(std::forward<T>(
t)) {
96 template <
typename...
Targs>
105template <
typename ValueType,
typename ErrorType>
115 template <
typename...
Targs>
122 return data.
index() == VALUE_INDEX;
126 return data.
index() == ERROR_INDEX;
146 static constexpr uint64_t VALUE_INDEX { 0 };
147 static constexpr uint64_t ERROR_INDEX { 1 };
153template <
typename ErrorType>
164 template <
typename...
Targs>
170 return data.
index() == VALUE_INDEX;
174 return data.
index() == ERROR_INDEX;
190 static constexpr uint64_t VALUE_INDEX { 0 };
191 static constexpr uint64_t ERROR_INDEX { 1 };
193 using DummyValueType =
bool;
194 static constexpr DummyValueType DUMMY_VALUE {
true };
199template <
typename ErrorType>
200constexpr typename expected_storage<void, ErrorType>::DummyValueType expected_storage<void, ErrorType>::DUMMY_VALUE;
203template <
typename T,
typename E>
207 return lhs.value_unchecked() ==
rhs.value_unchecked();
expected_storage(unexpect_t, Targs &&... args)
const ErrorType & error_unchecked() const
ErrorType & error_unchecked()
expected_storage() noexcept=delete
void value_unchecked() const
helper class to be able to handle 'void' value type specialization
const ErrorType & error_unchecked() const
ValueType & value_unchecked()
expected_storage() noexcept=delete
const ValueType & value_unchecked() const
ErrorType & error_unchecked()
expected_storage(unexpect_t, Targs &&... args)
Variant implementation from the C++17 standard with C++11. The interface is inspired by the C++17 sta...
constexpr uint64_t index() const noexcept
returns the index of the stored type in the variant. if the variant does not contain any type it retu...
typename std::enable_if<!std::is_void< T >::value, T >::type enable_if_non_void_t
helper trait for SFINEA to disable specific functions for 'void' value type
constexpr bool always_false_v
Helper value to bind a static_assert to a type.
constexpr in_place_t in_place
constexpr unexpect_t unexpect
typename std::enable_if<!std::is_lvalue_reference< T >::value, T >::type enable_if_not_lvalue_referece_t
helper trait for SFINEA to disable specific functions for lvalue references
typename std::enable_if< std::is_void< T >::value, T >::type enable_if_void_t
helper trait for SFINEA to disable specific functions for non 'void' value type
static constexpr bool is_same_value_unchecked(const expected_storage< void, E > &, const expected_storage< void, E > &)
helper struct for 'operator==' to be able to handle 'void' value type specialization
static constexpr bool is_same_value_unchecked(const expected_storage< T, E > &lhs, const expected_storage< T, E > &rhs)
helper struct to create an expected which is signalling an error more easily
err(Targs &&... args) noexcept
helper struct to create an expected which is signalling success more easily
ok(Targs &&... args) noexcept
helper struct to perform an emplacement at a predefined index in the constructor of a variant
helper struct which is used to call the in-place-construction constructor
helper struct which is used to call the in-place-construction constructor for error types