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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -