From eb3d3464db44072655f6a01f8540d782b51a1e0d Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 18 Jul 2005 20:33:59 +0000 Subject: [PATCH] operator< documenation fix. [SVN r30166] --- shared_ptr.htm | 28 ++++++++++++++-------------- weak_ptr.htm | 7 +++---- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/shared_ptr.htm b/shared_ptr.htm index 0b83d1f..fb15da1 100644 --- a/shared_ptr.htm +++ b/shared_ptr.htm @@ -50,8 +50,8 @@

shared_ptr is now part of TR1, the first C++ Library Technical Report. The latest draft of TR1 is available at the following location:

-

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1745.pdf (1.36Mb - PDF)

+

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1745.pdf + (1.36Mb PDF)

This implementation conforms to the TR1 specification, with the only exception that it resides in namespace boost instead of std::tr1.

Best Practices

@@ -402,7 +402,7 @@ q = p;
  • under the equivalence relation defined by operator<, !(a < b) && !(b < a), two shared_ptr instances - are equivalent if and only if they share ownership.
  • + are equivalent if and only if they share ownership or are both empty.

    Throws: nothing.

    Notes: Allows shared_ptr objects to be used as keys in associative containers.

    @@ -582,27 +582,27 @@ p3.reset(new int(2)); // undefined, multiple writes implementation on the following platforms:

    If your program is single-threaded and does not link to any libraries that might have used shared_ptr in its default configuration, you can #define the macro BOOST_SP_DISABLE_THREADS on a project-wide basis to switch to ordinary non-atomic reference count updates.

    -

    (Defining BOOST_SP_DISABLE_THREADS in some, but not - all, translation units is technically a violation of the One Definition - Rule and undefined behavior. Nevertheless, the implementation attempts to do - its best to accommodate the request to use non-atomic updates in those - translation units. No guarantees, though.)

    +

    (Defining BOOST_SP_DISABLE_THREADS in some, but not all, + translation units is technically a violation of the One Definition Rule and + undefined behavior. Nevertheless, the implementation attempts to do its best to + accommodate the request to use non-atomic updates in those translation units. + No guarantees, though.)

    You can define the macro BOOST_SP_USE_PTHREADS to turn off the - lock-free platform-specific implementation and fall back to the generic - pthread_mutex_t-based code.

    + lock-free platform-specific implementation and fall back to the generic pthread_mutex_t-based + code.

    Frequently Asked Questions

    Q. There are several variations of shared pointers, with different tradeoffs; why does the smart pointer library supply only a single diff --git a/weak_ptr.htm b/weak_ptr.htm index 3fcdcb7..e214d4a 100644 --- a/weak_ptr.htm +++ b/weak_ptr.htm @@ -145,9 +145,8 @@ template<class Y> weak_ptr & operator=(shared_ptr<Y> const &

    use_count

    long use_count() const;
    -

    Returns: 0 if *this is empty; otherwise, - the number of shared_ptr objects that share ownership - with *this.

    +

    Returns: 0 if *this is empty; otherwise, the + number of shared_ptr objects that share ownership with *this.

    Throws: nothing.

    Notes: use_count() is not necessarily efficient. Use only for debugging and testing purposes, not for production code.

    @@ -189,7 +188,7 @@ template<class Y> weak_ptr & operator=(shared_ptr<Y> const &
  • under the equivalence relation defined by operator<, !(a < b) && !(b < a), two weak_ptr instances - are equivalent if and only if they share ownership.
  • + are equivalent if and only if they share ownership or are both empty.

    Throws: nothing.

    Notes: Allows weak_ptr objects to be used as keys in associative containers.