Scott Meyers wrote:
Consider this constructor from the intrusive_ptr doc (http://boost.org/libs/smart_ptr/intrusive_ptr.html):
intrusive_ptr(T * p, bool add_ref = true);
Effects: if(p != 0 && add_ref) intrusive_ptr_add_ref(p);.
Note in particular that nothing is said about exceptions being thrown. Presumably intrusive_ptr_add_ref may throw, as I can't find any restriction to the contrary.
Now consider these constructors from the same document:
intrusive_ptr(intrusive_ptr const & r); // never throws template<class Y> intrusive_ptr(intrusive_ptr<Y> const & r); // never throws
Effects: if(r.get() != 0) intrusive_ptr_add_ref(r.get());.
They are documented not to throw, yet both call intrusive_ptr_add_ref. How can it be that the top constructor above may throw, but these constructors may not?
You are right, this is a documentation bug (similarly for operator=). The "// never throws" annotations aren't present in the synopsis. Fixed in CVS, thanks for the report.