Closed
Description
Hello, I'm trying to do something like the following in order to select the most compact optional available:
template <typename T>
using MinOptional = std::conditional_t<requires { stdx::optional<T>{}; },
stdx::optional<T>, std::optional<T>>;
// or
template <typename T>
using MinOptional = std::conditional_t<requires {
stdx::tombstone_traits<T>{}();
}, stdx::optional<T>, std::optional<T>>;
The idea was to select stdx::optional
if tombstone_traits
has been specialized and if not, select std::optional
. However, my attempt runs into a static assert for types that do not have the tombstone traits specialized. Is there currently a way to do this?
Metadata
Metadata
Assignees
Labels
No labels