Fix synopses

This commit is contained in:
Peter Dimov
2017-06-15 21:23:06 +03:00
parent 6db55f7dfd
commit 5b817ba04d
9 changed files with 148 additions and 161 deletions

View File

@@ -13,7 +13,6 @@ Greg Colvin, Beman Dawes, Peter Dimov, Glen Fernandes
:toclevels: 2 :toclevels: 2
:idprefix: :idprefix:
:listing-caption: Code Example :listing-caption: Code Example
:table-caption: Illustration
:docinfo: private-footer :docinfo: private-footer
:leveloffset: +1 :leveloffset: +1

View File

@@ -55,11 +55,9 @@ int main()
`enable_shared_from_this` is defined in `<boost/smart_ptr/enable_shared_from_this.hpp>`. `enable_shared_from_this` is defined in `<boost/smart_ptr/enable_shared_from_this.hpp>`.
``` ```
namespace boost namespace boost {
{
template<class T> class enable_shared_from_this template<class T> class enable_shared_from_this {
{
private: private:
// exposition only // exposition only
@@ -81,8 +79,7 @@ public:
weak_ptr<T> weak_from_this() noexcept; weak_ptr<T> weak_from_this() noexcept;
weak_ptr<T const> weak_from_this() const noexcept; weak_ptr<T const> weak_from_this() const noexcept;
} }
}
} // namespace boost
``` ```
## Members ## Members

View File

@@ -41,11 +41,9 @@ As a general rule, if it isn't obvious whether `intrusive_ptr` better fits your
`intrusive_ptr` is defined in `<boost/smart_ptr/intrusive_ptr.hpp>`. `intrusive_ptr` is defined in `<boost/smart_ptr/intrusive_ptr.hpp>`.
``` ```
namespace boost namespace boost {
{
template<class T> class intrusive_ptr template<class T> class intrusive_ptr {
{
public: public:
typedef T element_type; typedef T element_type;
@@ -71,7 +69,7 @@ public:
T * get() const noexcept; T * get() const noexcept;
T * detach() noexcept; T * detach() noexcept;
operator unspecified-bool-type() const noexcept; explicit operator bool () const noexcept;
void swap(intrusive_ptr & b) noexept; void swap(intrusive_ptr & b) noexept;
}; };
@@ -113,8 +111,7 @@ intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U> const & r) noexcept;
template<class E, class T, class Y> template<class E, class T, class Y>
std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os,
intrusive_ptr<Y> const & p); intrusive_ptr<Y> const & p);
}
} // namespace boost
``` ```
## Members ## Members
@@ -275,17 +272,18 @@ the implications are thoroughly understood.
### conversions ### conversions
``` ```
operator unspecified-bool-type () const noexcept; explicit operator bool () const noexcept;
``` ```
[none] [none]
* {blank} * {blank}
+ +
Returns:: an unspecified value that, when used in boolean contexts, is equivalent to `get() != 0`. Returns:: `get() != 0`.
NOTE: This conversion operator allows `intrusive_ptr` objects to be used in boolean contexts, NOTE: This conversion operator allows `intrusive_ptr` objects to be used in boolean contexts,
like `if (p && p\->valid()) {}`. The actual target type is typically a pointer to a member function, like `if (p && p\->valid()) {}`.
avoiding many of the implicit conversion pitfalls.
NOTE: On C++03 compilers, the return value is of an unspecified type.
### swap ### swap

View File

@@ -44,8 +44,7 @@ template <class IntPtr> class FloatPointerHolder
`pointer_to_other` is defined in `<boost/smart_ptr/pointer_to_other.hpp>`. `pointer_to_other` is defined in `<boost/smart_ptr/pointer_to_other.hpp>`.
``` ```
namespace boost namespace boost {
{
template<class T, class U> struct pointer_to_other; template<class T, class U> struct pointer_to_other;
@@ -75,8 +74,7 @@ template<class T, class U>
{ {
typedef U* type; typedef U* type;
}; };
}
} // namespace boost
``` ```
If these definitions are not correct for a specific smart pointer, we can define a specialization of `pointer_to_other`. If these definitions are not correct for a specific smart pointer, we can define a specialization of `pointer_to_other`.

View File

@@ -46,11 +46,9 @@ The class template is parameterized on `T`, the type of the object pointed to.
`scoped_array` is defined in `<boost/smart_ptr/scoped_array.hpp>`. `scoped_array` is defined in `<boost/smart_ptr/scoped_array.hpp>`.
``` ```
namespace boost namespace boost {
{
template<class T> class scoped_array template<class T> class scoped_array {
{
private: private:
scoped_array(scoped_array const &); scoped_array(scoped_array const &);
@@ -83,8 +81,7 @@ template<class T> bool operator==( std::nullptr_t, scoped_array<T> const & p ) n
template<class T> bool operator!=( scoped_array<T> const & p, std::nullptr_t ) noexcept; template<class T> bool operator!=( scoped_array<T> const & p, std::nullptr_t ) noexcept;
template<class T> bool operator!=( std::nullptr_t, scoped_array<T> const & p ) noexcept; template<class T> bool operator!=( std::nullptr_t, scoped_array<T> const & p ) noexcept;
}
} // namespace boost
``` ```
## Members ## Members

View File

@@ -42,11 +42,9 @@ and `T` must be complete at the point `scoped_ptr<T>::~scoped_ptr` is instantiat
`scoped_ptr` is defined in `<boost/smart_ptr/scoped_ptr.hpp>`. `scoped_ptr` is defined in `<boost/smart_ptr/scoped_ptr.hpp>`.
``` ```
namespace boost namespace boost {
{
template<class T> class scoped_ptr template<class T> class scoped_ptr {
{
private: private:
scoped_ptr(scoped_ptr const&); scoped_ptr(scoped_ptr const&);
@@ -80,8 +78,7 @@ template<class T> bool operator==( std::nullptr_t, scoped_ptr<T> const & p ) noe
template<class T> bool operator!=( scoped_ptr<T> const & p, std::nullptr_t ) noexcept; template<class T> bool operator!=( scoped_ptr<T> const & p, std::nullptr_t ) noexcept;
template<class T> bool operator!=( std::nullptr_t, scoped_ptr<T> const & p ) noexcept; template<class T> bool operator!=( std::nullptr_t, scoped_ptr<T> const & p ) noexcept;
}
} // namespace boost
``` ```
## Members ## Members

View File

@@ -52,6 +52,7 @@ below.
``` ```
namespace boost { namespace boost {
template<class T> class shared_array { template<class T> class shared_array {
public: public:
typedef T element_type; typedef T element_type;
@@ -237,8 +238,12 @@ Effects::: Exchanges the contents of the two smart pointers.
``` ```
template<class T> bool template<class T> bool
operator==(const shared_array<T>& a, const shared_array<T>& b) noexcept; operator==(const shared_array<T>& a, const shared_array<T>& b) noexcept;
```
```
template<class T> bool template<class T> bool
operator!=(const shared_array<T>& a, const shared_array<T>& b) noexcept; operator!=(const shared_array<T>& a, const shared_array<T>& b) noexcept;
```
```
template<class T> bool template<class T> bool
operator<(const shared_array<T>& a, const shared_array<T>& b) noexcept; operator<(const shared_array<T>& a, const shared_array<T>& b) noexcept;
``` ```
@@ -261,5 +266,5 @@ template<class T>
void swap(shared_array<T>& a, shared_array<T>& b) noexcept; void swap(shared_array<T>& a, shared_array<T>& b) noexcept;
``` ```
:: ::
Returns::: `a.swap(b)` Returns::: `a.swap(b)`.
Requires::: `T` is a complete type. Requires::: `T` is a complete type.

View File

@@ -103,15 +103,13 @@ functions defined in `<boost/smart_ptr/make_shared.hpp>`. These factory function
`shared_ptr` is defined in `<boost/smart_ptr/shared_ptr.hpp>`. `shared_ptr` is defined in `<boost/smart_ptr/shared_ptr.hpp>`.
``` ```
namespace boost namespace boost {
{
class bad_weak_ptr: public std::exception; class bad_weak_ptr: public std::exception;
template<class T> class weak_ptr; template<class T> class weak_ptr;
template<class T> class shared_ptr template<class T> class shared_ptr {
{
public: public:
typedef /*see below*/ element_type; typedef /*see below*/ element_type;
@@ -222,8 +220,7 @@ template<class E, class T, class Y>
operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p); operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p);
template<class D, class T> D * get_deleter(shared_ptr<T> const & p) noexcept; template<class D, class T> D * get_deleter(shared_ptr<T> const & p) noexcept;
}
} // namespace boost
``` ```
## Members ## Members
@@ -611,6 +608,8 @@ NOTE: This conversion operator allows `shared_ptr` objects to be used in boolean
NOTE: The conversion to `bool` is not merely syntactic sugar. It allows `shared_ptr` variables to be declared in conditions when using NOTE: The conversion to `bool` is not merely syntactic sugar. It allows `shared_ptr` variables to be declared in conditions when using
`dynamic_pointer_cast` or `weak_ptr::lock`. `dynamic_pointer_cast` or `weak_ptr::lock`.
NOTE: On C++03 compilers, the return value is of an unspecified type.
### swap ### swap
``` ```
void swap(shared_ptr & b) noexcept; void swap(shared_ptr & b) noexcept;

View File

@@ -73,11 +73,9 @@ Now `r` holds a reference to the object that was pointed by `q`. Even if `p.rese
`weak_ptr` is defined in `<boost/smart_ptr/weak_ptr.hpp>`. `weak_ptr` is defined in `<boost/smart_ptr/weak_ptr.hpp>`.
``` ```
namespace boost namespace boost {
{
template<class T> class weak_ptr template<class T> class weak_ptr {
{
public: public:
typedef /*see below*/ element_type; typedef /*see below*/ element_type;
@@ -114,8 +112,7 @@ template<class T, class U>
bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) noexcept; bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) noexcept;
template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) noexcept; template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) noexcept;
}
} // namespace boost
``` ```
## Members ## Members