Added Rationale section from the original docs in Boost.Utility.

This commit is contained in:
Andrey Semashev
2014-06-12 21:06:45 +04:00
parent 3408d02684
commit e3e304fc21
2 changed files with 18 additions and 1 deletions

View File

@@ -22,7 +22,8 @@
The header `<boost/core/addressof.hpp>` defines the function
template `boost::addressof`. `boost::addressof(x)` returns the
address of `x`. Ordinarily, this address can be obtained by
`&x`, but the unary `&` operator can be overloaded.
`&x`, but the unary `&` operator can be overloaded. `boost::addressof`
avoids calling used-defined `operator&()`.
`boost::addressof` was originally contributed by Brad King
based on ideas from discussion with Doug Gregor.

View File

@@ -51,6 +51,22 @@ class X: private boost::noncopyable
[endsect]
[section Rationale]
Class noncopyable has protected constructor and destructor members to emphasize
that it is to be used only as a base class. Dave Abrahams notes concern 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.]
With C++2011, using an optimized and trivial constructor and similar destructor
can be enforced by declaring both and marking them `default`. This is done in
the current implementation.
[endsect]
[endsect]
[endsect]