Following works fine:
struct X { }; // OK
static_assert(std::is_default_constructible<X>::value, "Error");
Following assert fails to compile:
struct X { static_assert(std::is_default_constructible<X>::value, "Error"); }; // Fails
Why does the static_assert inside the class fail?
Side Qn: Is std::is_default_constructible supposed to fail for the classes with private constructors as discussed in:
std::is_default_constructible<T> error, if constructor is private
Aucun commentaire:
Enregistrer un commentaire