forked from boostorg/smart_ptr
Fix synopses
This commit is contained in:
@ -13,7 +13,6 @@ Greg Colvin, Beman Dawes, Peter Dimov, Glen Fernandes
|
||||
:toclevels: 2
|
||||
:idprefix:
|
||||
:listing-caption: Code Example
|
||||
:table-caption: Illustration
|
||||
:docinfo: private-footer
|
||||
|
||||
:leveloffset: +1
|
||||
|
@ -55,17 +55,15 @@ int main()
|
||||
`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
|
||||
{
|
||||
private:
|
||||
template<class T> class enable_shared_from_this {
|
||||
private:
|
||||
|
||||
// exposition only
|
||||
weak_ptr<T> weak_this_;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
enable_shared_from_this() = default;
|
||||
~enable_shared_from_this() = default;
|
||||
@ -73,16 +71,15 @@ protected:
|
||||
enable_shared_from_this(const enable_shared_from_this&) noexcept;
|
||||
enable_shared_from_this& operator=(const enable_shared_from_this&) noexcept;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
shared_ptr<T> shared_from_this();
|
||||
shared_ptr<T const> shared_from_this() const;
|
||||
|
||||
weak_ptr<T> weak_from_this() noexcept;
|
||||
weak_ptr<T const> weak_from_this() const noexcept;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
```
|
||||
|
||||
## Members
|
||||
|
@ -41,12 +41,10 @@ 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>`.
|
||||
|
||||
```
|
||||
namespace boost
|
||||
{
|
||||
namespace boost {
|
||||
|
||||
template<class T> class intrusive_ptr
|
||||
{
|
||||
public:
|
||||
template<class T> class intrusive_ptr {
|
||||
public:
|
||||
|
||||
typedef T element_type;
|
||||
|
||||
@ -71,50 +69,49 @@ public:
|
||||
T * get() const noexcept;
|
||||
T * detach() noexcept;
|
||||
|
||||
operator unspecified-bool-type() const noexcept;
|
||||
explicit operator bool () const noexcept;
|
||||
|
||||
void swap(intrusive_ptr & b) noexept;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
bool operator==(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
template<class T, class U>
|
||||
bool operator==(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
template<class T, class U>
|
||||
bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
bool operator==(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
template<class T, class U>
|
||||
bool operator==(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
bool operator!=(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
template<class T, class U>
|
||||
bool operator!=(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
bool operator==(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
template<class T, class U>
|
||||
bool operator==(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
bool operator!=(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
template<class T, class U>
|
||||
bool operator!=(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
template<class T, class U>
|
||||
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T> void swap(intrusive_ptr<T> & a, intrusive_ptr<T> & b) noexcept;
|
||||
template<class T> void swap(intrusive_ptr<T> & a, intrusive_ptr<T> & b) noexcept;
|
||||
|
||||
template<class T> T * get_pointer(intrusive_ptr<T> const & p) noexcept;
|
||||
template<class T> T * get_pointer(intrusive_ptr<T> const & p) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> const_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> const_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
|
||||
template<class E, class T, class Y>
|
||||
std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os,
|
||||
intrusive_ptr<Y> const & p);
|
||||
|
||||
} // namespace boost
|
||||
template<class E, class T, class Y>
|
||||
std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os,
|
||||
intrusive_ptr<Y> const & p);
|
||||
}
|
||||
```
|
||||
|
||||
## Members
|
||||
@ -275,17 +272,18 @@ the implications are thoroughly understood.
|
||||
### conversions
|
||||
|
||||
```
|
||||
operator unspecified-bool-type () const noexcept;
|
||||
explicit operator bool () const noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
* {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,
|
||||
like `if (p && p\->valid()) {}`. The actual target type is typically a pointer to a member function,
|
||||
avoiding many of the implicit conversion pitfalls.
|
||||
like `if (p && p\->valid()) {}`.
|
||||
|
||||
NOTE: On C++03 compilers, the return value is of an unspecified type.
|
||||
|
||||
### swap
|
||||
|
||||
@ -304,7 +302,7 @@ Effects:: Exchanges the contents of the two smart pointers.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator==(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
bool operator==(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -314,7 +312,7 @@ Returns:: `a.get() == b.get()`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -324,7 +322,7 @@ Returns:: `a.get() != b.get()`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator==(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
bool operator==(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -334,7 +332,7 @@ Returns:: `a.get() == b`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator!=(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
bool operator!=(intrusive_ptr<T> const & a, U * b) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -344,7 +342,7 @@ Returns:: `a.get() != b`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator==(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
bool operator==(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -354,7 +352,7 @@ Returns:: `a == b.get()`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator!=(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
bool operator!=(T * a, intrusive_ptr<U> const & b) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -364,7 +362,7 @@ Returns:: `a != b.get()`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -402,7 +400,7 @@ NOTE: Provided as an aid to generic programming. Used by `mem_fn`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -414,7 +412,7 @@ Returns:: `intrusive_ptr<T>(static_cast<T*>(r.get()))`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> const_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
intrusive_ptr<T> const_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -426,7 +424,7 @@ Returns:: `intrusive_ptr<T>(const_cast<T*>(r.get()))`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U> const & r) noexcept;
|
||||
```
|
||||
|
||||
[none]
|
||||
@ -438,7 +436,7 @@ Returns:: `intrusive_ptr<T>(dynamic_cast<T*>(r.get()))`.
|
||||
|
||||
```
|
||||
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);
|
||||
```
|
||||
|
||||
|
@ -44,39 +44,37 @@ template <class IntPtr> class FloatPointerHolder
|
||||
`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;
|
||||
|
||||
template<class T, class U,
|
||||
template <class> class Sp>
|
||||
struct pointer_to_other< Sp<T>, U >
|
||||
{
|
||||
typedef Sp<U> type;
|
||||
};
|
||||
template<class T, class U,
|
||||
template <class> class Sp>
|
||||
struct pointer_to_other< Sp<T>, U >
|
||||
{
|
||||
typedef Sp<U> type;
|
||||
};
|
||||
|
||||
template<class T, class T2, class U,
|
||||
template <class, class> class Sp>
|
||||
struct pointer_to_other< Sp<T, T2>, U >
|
||||
{
|
||||
template<class T, class T2, class U,
|
||||
template <class, class> class Sp>
|
||||
struct pointer_to_other< Sp<T, T2>, U >
|
||||
{
|
||||
typedef Sp<U, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T, class T2, class T3, class U,
|
||||
template <class, class, class> class Sp>
|
||||
struct pointer_to_other< Sp<T, T2, T3>, U >
|
||||
{
|
||||
template<class T, class T2, class T3, class U,
|
||||
template <class, class, class> class Sp>
|
||||
struct pointer_to_other< Sp<T, T2, T3>, U >
|
||||
{
|
||||
typedef Sp<U, T2, T3> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
struct pointer_to_other< T*, U >
|
||||
{
|
||||
template<class T, class U>
|
||||
struct pointer_to_other< T*, U >
|
||||
{
|
||||
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`.
|
||||
|
@ -46,12 +46,10 @@ 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>`.
|
||||
|
||||
```
|
||||
namespace boost
|
||||
{
|
||||
namespace boost {
|
||||
|
||||
template<class T> class scoped_array
|
||||
{
|
||||
private:
|
||||
template<class T> class scoped_array {
|
||||
private:
|
||||
|
||||
scoped_array(scoped_array const &);
|
||||
scoped_array & operator=(scoped_array const &);
|
||||
@ -59,7 +57,7 @@ private:
|
||||
void operator==( scoped_array const& ) const;
|
||||
void operator!=( scoped_array const& ) const;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
typedef T element_type;
|
||||
|
||||
@ -74,17 +72,16 @@ public:
|
||||
explicit operator bool () const noexcept;
|
||||
|
||||
void swap(scoped_array & b) noexcept;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T> void swap(scoped_array<T> & a, scoped_array<T> & b) noexcept;
|
||||
template<class T> void swap(scoped_array<T> & a, scoped_array<T> & b) 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==( 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!=( scoped_array<T> const & p, std::nullptr_t ) noexcept;
|
||||
template<class T> bool operator!=( std::nullptr_t, scoped_array<T> const & p ) noexcept;
|
||||
|
||||
} // namespace boost
|
||||
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;
|
||||
}
|
||||
```
|
||||
|
||||
## Members
|
||||
|
@ -42,12 +42,10 @@ 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>`.
|
||||
|
||||
```
|
||||
namespace boost
|
||||
{
|
||||
namespace boost {
|
||||
|
||||
template<class T> class scoped_ptr
|
||||
{
|
||||
private:
|
||||
template<class T> class scoped_ptr {
|
||||
private:
|
||||
|
||||
scoped_ptr(scoped_ptr const&);
|
||||
scoped_ptr& operator=(scoped_ptr const&);
|
||||
@ -55,7 +53,7 @@ private:
|
||||
void operator==(scoped_ptr const&) const;
|
||||
void operator!=(scoped_ptr const&) const;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
typedef T element_type;
|
||||
|
||||
@ -71,17 +69,16 @@ public:
|
||||
explicit operator bool() const noexcept;
|
||||
|
||||
void swap(scoped_ptr & b) noexcept;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T> void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) noexcept;
|
||||
template<class T> void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) 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==( 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!=( scoped_ptr<T> const & p, std::nullptr_t ) noexcept;
|
||||
template<class T> bool operator!=( std::nullptr_t, scoped_ptr<T> const & p ) noexcept;
|
||||
|
||||
} // namespace boost
|
||||
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;
|
||||
}
|
||||
```
|
||||
|
||||
## Members
|
||||
|
@ -52,6 +52,7 @@ below.
|
||||
|
||||
```
|
||||
namespace boost {
|
||||
|
||||
template<class T> class shared_array {
|
||||
public:
|
||||
typedef T element_type;
|
||||
@ -237,8 +238,12 @@ Effects::: Exchanges the contents of the two smart pointers.
|
||||
```
|
||||
template<class T> bool
|
||||
operator==(const shared_array<T>& a, const shared_array<T>& b) noexcept;
|
||||
```
|
||||
```
|
||||
template<class T> bool
|
||||
operator!=(const shared_array<T>& a, const shared_array<T>& b) noexcept;
|
||||
```
|
||||
```
|
||||
template<class T> bool
|
||||
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;
|
||||
```
|
||||
::
|
||||
Returns::: `a.swap(b)`
|
||||
Requires::: `T` is a complete type.
|
||||
Returns::: `a.swap(b)`.
|
||||
Requires::: `T` is a complete type.
|
||||
|
@ -103,16 +103,14 @@ functions defined in `<boost/smart_ptr/make_shared.hpp>`. These factory function
|
||||
`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
|
||||
{
|
||||
public:
|
||||
template<class T> class shared_ptr {
|
||||
public:
|
||||
|
||||
typedef /*see below*/ element_type;
|
||||
|
||||
@ -182,48 +180,47 @@ public:
|
||||
|
||||
template<class Y> bool owner_before(shared_ptr<Y> const & rhs) const noexcept;
|
||||
template<class Y> bool owner_before(weak_ptr<Y> const & rhs) const noexcept;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
|
||||
template<class T> bool operator==(shared_ptr<T> const & p, std::nullptr_t) noexcept;
|
||||
template<class T> bool operator==(std::nullptr_t, shared_ptr<T> const & p) noexcept;
|
||||
template<class T> bool operator==(shared_ptr<T> const & p, std::nullptr_t) noexcept;
|
||||
template<class T> bool operator==(std::nullptr_t, shared_ptr<T> const & p) noexcept;
|
||||
|
||||
template<class T> bool operator!=(shared_ptr<T> const & p, std::nullptr_t) noexcept;
|
||||
template<class T> bool operator!=(std::nullptr_t, shared_ptr<T> const & p) noexcept;
|
||||
template<class T> bool operator!=(shared_ptr<T> const & p, std::nullptr_t) noexcept;
|
||||
template<class T> bool operator!=(std::nullptr_t, shared_ptr<T> const & p) noexcept;
|
||||
|
||||
template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b) noexcept;
|
||||
template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b) noexcept;
|
||||
|
||||
template<class T>
|
||||
template<class T>
|
||||
typename shared_ptr<T>::element_type *
|
||||
get_pointer(shared_ptr<T> const & p) noexcept;
|
||||
get_pointer(shared_ptr<T> const & p) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
shared_ptr<T> reinterpret_pointer_cast(shared_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, 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;
|
||||
|
||||
} // namespace boost
|
||||
template<class D, class T> D * get_deleter(shared_ptr<T> const & p) noexcept;
|
||||
}
|
||||
```
|
||||
|
||||
## 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
|
||||
`dynamic_pointer_cast` or `weak_ptr::lock`.
|
||||
|
||||
NOTE: On C++03 compilers, the return value is of an unspecified type.
|
||||
|
||||
### swap
|
||||
```
|
||||
void swap(shared_ptr & b) noexcept;
|
||||
@ -637,7 +636,7 @@ Effects:: See the description of `operator<`.
|
||||
### comparison
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
@ -646,7 +645,7 @@ Returns:: `a.get() == b.get()`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
@ -677,7 +676,7 @@ Returns:: `p.get() != 0`.
|
||||
|
||||
```
|
||||
template<class T, class U>
|
||||
bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
@ -703,7 +702,7 @@ Effects:: Equivalent to `a.swap(b)`.
|
||||
### get_pointer
|
||||
```
|
||||
template<class T>
|
||||
typename shared_ptr<T>::element_type *
|
||||
typename shared_ptr<T>::element_type *
|
||||
get_pointer(shared_ptr<T> const & p) noexcept;
|
||||
```
|
||||
[none]
|
||||
@ -716,7 +715,7 @@ NOTE: Provided as an aid to generic programming. Used by `mem_fn`.
|
||||
### static_pointer_cast
|
||||
```
|
||||
template<class T, class U>
|
||||
shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
@ -730,7 +729,7 @@ result in undefined behavior, attempting to delete the same object twice.
|
||||
### const_pointer_cast
|
||||
```
|
||||
template<class T, class U>
|
||||
shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
@ -754,7 +753,7 @@ Returns::
|
||||
### reinterpret_pointer_cast
|
||||
```
|
||||
template<class T, class U>
|
||||
shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U> const & r) noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
@ -765,7 +764,7 @@ Returns:: `shared_ptr<T>( r, reinterpret_cast<typename shared_ptr<T>::element_ty
|
||||
### operator<<
|
||||
```
|
||||
template<class E, class T, class Y>
|
||||
std::basic_ostream<E, T> &
|
||||
std::basic_ostream<E, T> &
|
||||
operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p);
|
||||
```
|
||||
[none]
|
||||
@ -777,7 +776,7 @@ Returns:: `os`.
|
||||
### get_deleter
|
||||
```
|
||||
template<class D, class T>
|
||||
D * get_deleter(shared_ptr<T> const & p) noexcept;
|
||||
D * get_deleter(shared_ptr<T> const & p) noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
|
@ -73,12 +73,10 @@ 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>`.
|
||||
|
||||
```
|
||||
namespace boost
|
||||
{
|
||||
namespace boost {
|
||||
|
||||
template<class T> class weak_ptr
|
||||
{
|
||||
public:
|
||||
template<class T> class weak_ptr {
|
||||
public:
|
||||
|
||||
typedef /*see below*/ element_type;
|
||||
|
||||
@ -108,14 +106,13 @@ public:
|
||||
|
||||
template<class Y> bool owner_before( weak_ptr<Y> const & r ) const noexcept;
|
||||
template<class Y> bool owner_before( shared_ptr<Y> const & r ) const noexcept;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
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;
|
||||
|
||||
} // namespace boost
|
||||
template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) noexcept;
|
||||
}
|
||||
```
|
||||
|
||||
## Members
|
||||
@ -250,7 +247,7 @@ Returns:: See the description of `operator<`.
|
||||
### comparison
|
||||
```
|
||||
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;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
|
Reference in New Issue
Block a user