#undef NDEBUG
auto main() -> int
{
using etl::nullopt;
auto opt0 = optional<short>();
assert(opt0.has_value() ==
false);
assert(
static_cast<bool>(opt0) ==
false);
auto opt1 = optional<int>(nullopt);
assert(opt1.has_value() ==
false);
assert(
static_cast<bool>(opt1) ==
false);
auto opt2 = optional<float>(42.0F);
assert(
static_cast<bool>(opt2));
auto const opt3 = opt2;
assert(
static_cast<bool>(opt3));
assert(
static_cast<bool>(opt4));
assert(optional<int>().value_or(1) == 1);
auto opt5 = optional<float>(1.0F);
opt5.reset();
assert(opt5.has_value() ==
false);
return 0;
}
#define assert(...)
Definition cassert.hpp:19
constexpr auto move(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Moves the elements in the range [first, last), to another range beginning at destination,...
Definition move.hpp:26
The class template optional manages an optional contained value, i.e. a value that may or may not be ...
Definition optional.hpp:89