Czy ktoś mądry może mi powiedzieć, dlaczego B
i C
nie są move-constructible
?
#include <iostream>
#include <type_traits>
using namespace std;
struct A
{
A(const A&) {}
};
struct B
{
B(const B&) {};
private:
B(B&&);
};
struct C
{
C(const C&) {};
C(C&&) = delete;
};
int main()
{
cout << boolalpha << is_move_constructible<A>::value << endl; // true
cout << boolalpha << is_move_constructible<B>::value << endl; // false
cout << boolalpha << is_move_constructible<C>::value << endl; // false
}
http://en.cppreference.com/w/cpp/concept/MoveConstructible
Types without a move constructor, but with a copy constructor that accepts const T& arguments, satisfy std::is_move_constructible.