Skip to content

Instantly share code, notes, and snippets.

@acmorrow
Created February 5, 2013 20:07
Show Gist options
  • Save acmorrow/4717221 to your computer and use it in GitHub Desktop.
Save acmorrow/4717221 to your computer and use it in GitHub Desktop.
// In C++03, we need to resort to tricks or funky
// base classes to control whether classes are copyable:
class Foo : public boost::noncopyable{};
class Bar {
private:
Bar(const Bar&); // Not implemented
Bar& operator=(const Bar&); // Not implemented
};
// In C++11, we don't need these hacks:
class Awesome {
Awesome(const Awesome&) = delete;
Awesome& operator=(const Awesome&) = delete;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment