Why is std::initializer_list<_E>::size not allowable in a static_assert, even though it\'s declared as a constexpr in my libstdc++ (v. 4.6)?
For example, the foll
"Initializer lists" are just horrible kludges.
Don't:
#include
template
void Dont(std::initializer_list list) { // Bad!
static_assert(list.size() == 3, "Exactly three elements are required.");
}
void Test() { Dont({1,2,3}); }
Do:
template
void Do(const T(&list)[N]) { // Good!
static_assert(N == 3, "Exactly three elements are required.");
}
void Test() { Do({1,2,3}); }