diff --git a/include/boost/noncopyable.hpp b/include/boost/noncopyable.hpp
index 7770bdb..eb8e2e7 100644
--- a/include/boost/noncopyable.hpp
+++ b/include/boost/noncopyable.hpp
@@ -9,6 +9,8 @@
#ifndef BOOST_NONCOPYABLE_HPP_INCLUDED
#define BOOST_NONCOPYABLE_HPP_INCLUDED
+#include
The traditional way to deal with these is to declare a private copy constructor
- and copy assignment, and then document why this is done. But deriving
- from noncopyable is simpler and clearer, and doesn't require additional
+ and copy assignment, and then document why this is done. A new alternative
+ was introduced in C++2011, declaring a copy constructor and a copy assignment
+ operator, but marking both as delete
d. Deriving
+ from noncopyable is simpler and clearer, and doesn't require additional
documentation.
The program noncopyable_test.cpp can be used to verify class noncopyable works as expected. It has have been run @@ -106,7 +108,9 @@ class ResourceLadenFileSystem : boost::noncopyable { about the effect on compiler optimization of adding (even trivial inline) destructor declarations. He says "Probably this concern is misplaced, because noncopyable will be used mostly for classes which own resources and - thus have non-trivial destruction semantics."
+ thus have non-trivial destruction semantics." With C++2011, using an + optimized and trivial constructor and similar destructor can be enforced by + declaring both and marking themdefault
.
Function addressof() returns the address of an object.