The following code doesn't compile -
struct A {
A() = default;
A(const A& other) = delete;
};
int main()
{
auto a = A();
auto u = std::make_unique<A>(std::move(a));
}
While the following does -
struct A {
A() = default;
A(const A& other) = delete;
A(A&& other) = default;
};
int main()
{
auto u = std::make_unique<A>(A());
}
The error I got is call to implicitly-deleted copy constructor
.
Im using a blaze compiler for cpp-17.
Why does the first code segment not compile? It shouldn't use the copy contractor, just the move one.
Edit:
Adding A(A&& other) = default;
solves the issue.
Does this mean that deleting the copy-contractor also deletes the move-contractor implicitly, and it needs to be added?