c++ - std::is_copy/move_constructible fails even though copy/move constructors are defaulted -
i have class input, has default move/copy constructors.
input(const input &) = default; input(input &&) = default;
the following assertions fail however.
static_assert(std::is_copy_constructible<input>(), "input not copy-constructible"); static_assert(std::is_move_constructible<input>(), "input not move-constructible");
why that?
here full example:
#include <type_traits> class { public: a(const &) = default; static_assert(std::is_copy_constructible<a>(), ""); }; int main() { // code goes here return 0; }
your problem static_assert
in class declaration. compiler can't know sure when reaches static_assert
whether class copy- or move-constructible, because class hasn't been defined yet.
Comments
Post a Comment