Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
copy reference
// Example program
#include <iostream>
#include <string>
struct nocopy {
nocopy(int i_) : i(i_) {}
nocopy( const nocopy& ) = delete;
int i;
};
struct test {
test( nocopy& n_ ) : n( n_ ) {}
test( const test& other ): n(other.n) {}
nocopy& n;
};
int main()
{
nocopy n{ 1 };
test t{ n };
test t1{ t };
std::cout << "I: " << t1.n.i << '\n';
}
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.