Struct BareSpecValues

Struct Documentation

struct BareSpecValues

what a bare brace list in the spec argument of IndexBasisRegistry::add() and its kin, {10} or {Spin::any, true}, binds to once IndexSpaceSpec and IndexBasisSpec reject it, through its one constructor. Nothing else reaches it: a bare value has no converting constructor to use, an empty {} no default constructor, and a designated list initializes aggregates only, so those bind to the spec and to the argument-list overloads as before. The overloads that take this fail with a diagnostic that names the spec spelling. A list of mixed types, {Spin::any, true}, has no std::initializer_list<T> and keeps the compiler’s own diagnostic, as does {{}, 10}: the spec’s guard rejects it only once chosen, so the spec and this helper are both viable for it and the call is ambiguous.

Note

list-initialization of a class, so that no compiler deduces from the list against a template parameter: MSVC forms std::initializer_list<void> for a designated list against std::initializer_list<T>, and gcc reads a designated list against const T (&)[N] as a GNU array designator, hard errors both rather than deduction failures

Public Functions

template<typename T>
inline constexpr BareSpecValues(std::initializer_list<T>) noexcept