Skip to content

Instantly share code, notes, and snippets.

@mrdomino mrdomino/copies.c++
Last active Oct 24, 2015

What would you like to do?
copy and assignment operator autogeneration
class A {};
class B {
B() = default;
B(B const&) = delete;
class C {
C() = default;
C(C const&) = delete;
C& operator=(C const&) = delete;
class D {
D() = default;
D& operator=(D const&) = delete;
int main() {
A a1;
A a2(a1);
A a3; a3 = a1;
B b1;
//B b2(b1); // nope
B b3; b3 = b1;
C c1;
//C c2(c1); // nope
//C c3; c3 = c1; // nope
D d1;
D d2(d1);
//D d3; d3 = d1; // nope
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.