std::experimental::nonesuch
From cppreference.com
< cpplrm; | experimental
Defined in header <experimental/type_traits>
|
||
struct nonesuch { nonesuch() = delete; |
(library fundamentals TS v2) | |
std::experimental::nonesuch
is a class type used by std::experimental::detected_t to indicate detection failure.
Notes
nonesuch
cannot be constructed, destroyed, or copied in the usual way. However, it is an aggregate and therefore can be constructed (presumably unintentionally) via aggregate initialization in contexts where the destructor's availability is not an issue, such as a new-expression: new std::experimental::nonesuch{}.
Additionally, for overload resolution purposes, an implicit conversion sequence can be formed from {} (an empty braced-init-list) to nonesuch
. This can cause surprising ambiguities:
struct such {}; void f(const such&); void f(const std::experimental::nonesuch&); f({}); // ambiguous