diff --git a/trunk/boost/noncopyable.hpp b/trunk/boost/noncopyable.hpp
|
a
|
b
|
|
| 9 | 9 | #ifndef BOOST_NONCOPYABLE_HPP_INCLUDED |
| 10 | 10 | #define BOOST_NONCOPYABLE_HPP_INCLUDED |
| 11 | 11 | |
| | 12 | #include <boost/config.hpp> |
| | 13 | |
| 12 | 14 | namespace boost { |
| 13 | 15 | |
| 14 | 16 | // Private copy constructor and copy assignment ensure classes derived from |
| … |
… |
|
| 21 | 23 | class noncopyable |
| 22 | 24 | { |
| 23 | 25 | protected: |
| | 26 | #ifndef BOOST_NO_DEFAULTED_FUNCTIONS |
| | 27 | BOOST_CONSTEXPR noncopyable() = default; |
| | 28 | ~noncopyable() = default; |
| | 29 | #else |
| 24 | 30 | noncopyable() {} |
| 25 | 31 | ~noncopyable() {} |
| | 32 | #endif |
| | 33 | #ifndef BOOST_NO_DELETED_FUNCTIONS |
| | 34 | noncopyable( const noncopyable& ) = delete; |
| | 35 | const noncopyable& operator=( const noncopyable& ) = delete; |
| | 36 | #else |
| 26 | 37 | private: // emphasize the following members are private |
| 27 | 38 | noncopyable( const noncopyable& ); |
| 28 | 39 | const noncopyable& operator=( const noncopyable& ); |
| | 40 | #endif |
| 29 | 41 | }; |
| 30 | 42 | } |
| 31 | 43 | |
diff --git a/trunk/libs/utility/utility.htm b/trunk/libs/utility/utility.htm
|
a
|
b
|
|
| 84 | 84 | will prevent the otherwise implicitly-generated functions (which don't have the |
| 85 | 85 | proper semantics) from becoming a trap for other programmers.</p> |
| 86 | 86 | <p>The traditional way to deal with these is to declare a private copy constructor |
| 87 | | and copy assignment, and then document why this is done. But deriving |
| | 87 | and copy assignment, and then document why this is done. A new alternative |
| | 88 | was introduced in C++2011, declaring a copy constructor and a copy assignment |
| | 89 | operator, but marking both as <code>delete</code>d. Deriving |
| 88 | 90 | from <b>noncopyable</b> is simpler and clearer, and doesn't require additional |
| 89 | 91 | documentation.</p> |
| 90 | 92 | <p>The program <a href="noncopyable_test.cpp">noncopyable_test.cpp</a> can be used |
| … |
… |
|
| 106 | 108 | about the effect on compiler optimization of adding (even trivial inline) |
| 107 | 109 | destructor declarations. He says "Probably this concern is misplaced, |
| 108 | 110 | because noncopyable will be used mostly for classes which own resources and |
| 109 | | thus have non-trivial destruction semantics."</p> |
| | 111 | thus have non-trivial destruction semantics." With C++2011, using an |
| | 112 | optimized and trivial constructor and similar destructor can be enforced by |
| | 113 | declaring both and marking them <code>default</code>.</p> |
| 110 | 114 | <h2><a name="addressof">Function template addressof()</a></h2> |
| 111 | 115 | <p>Function <strong>addressof()</strong> returns the address of an object.</p> |
| 112 | 116 | <blockquote> |
| … |
… |
|
| 313 | 317 | </pre></blockquote> |
| 314 | 318 | <hr> |
| 315 | 319 | <p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan |
| 316 | | -->04 September, 2008<!--webbot bot="Timestamp" endspan i-checksum="39369" |
| | 320 | -->18 February, 2012<!--webbot bot="Timestamp" endspan i-checksum="39369" |
| 317 | 321 | --> |
| 318 | 322 | </p> |
| 319 | 323 | <p>© Copyright Beman Dawes 1999-2003.</p> |