mirror of
https://github.com/boostorg/smart_ptr.git
synced 2026-02-08 08:05:44 +01:00
Compare commits
6 Commits
feature/ow
...
feature/ow
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7c0eacb74 | ||
|
|
9ed9f43ca8 | ||
|
|
0ddf990869 | ||
|
|
a08a5f3d41 | ||
|
|
77c2d4cad7 | ||
|
|
fd612dc114 |
@@ -18,40 +18,25 @@ Greg Colvin, Beman Dawes, Peter Dimov, Glen Fernandes
|
||||
:leveloffset: +1
|
||||
|
||||
include::smart_ptr/introduction.adoc[]
|
||||
|
||||
include::smart_ptr/changelog.adoc[]
|
||||
|
||||
include::smart_ptr/scoped_ptr.adoc[]
|
||||
|
||||
include::smart_ptr/scoped_array.adoc[]
|
||||
|
||||
include::smart_ptr/shared_ptr.adoc[]
|
||||
|
||||
include::smart_ptr/weak_ptr.adoc[]
|
||||
|
||||
include::smart_ptr/make_shared.adoc[]
|
||||
|
||||
include::smart_ptr/enable_shared_from_this.adoc[]
|
||||
|
||||
include::smart_ptr/enable_shared_from.adoc[]
|
||||
|
||||
include::smart_ptr/make_unique.adoc[]
|
||||
|
||||
include::smart_ptr/allocate_unique.adoc[]
|
||||
|
||||
include::smart_ptr/intrusive_ptr.adoc[]
|
||||
|
||||
include::smart_ptr/intrusive_ref_counter.adoc[]
|
||||
|
||||
include::smart_ptr/local_shared_ptr.adoc[]
|
||||
|
||||
include::smart_ptr/make_local_shared.adoc[]
|
||||
|
||||
include::smart_ptr/pointer_cast.adoc[]
|
||||
|
||||
include::smart_ptr/pointer_to_other.adoc[]
|
||||
|
||||
include::smart_ptr/atomic_shared_ptr.adoc[]
|
||||
include::smart_ptr/owner_less.adoc[]
|
||||
include::smart_ptr/owner_equal_to.adoc[]
|
||||
|
||||
// appendix
|
||||
include::smart_ptr/techniques.adoc[]
|
||||
@@ -73,7 +58,7 @@ This documentation is
|
||||
* Copyright 1999 Greg Colvin
|
||||
* Copyright 1999 Beman Dawes
|
||||
* Copyright 2002 Darin Adler
|
||||
* Copyright 2003-2017 Peter Dimov
|
||||
* Copyright 2003-2020 Peter Dimov
|
||||
* Copyright 2005, 2006 Ion Gaztañaga
|
||||
* Copyright 2008 Frank Mori Hess
|
||||
* Copyright 2012-2017 Glen Fernandes
|
||||
|
||||
@@ -16,6 +16,7 @@ http://www.boost.org/LICENSE_1_0.txt
|
||||
## Changes in 1.74.0
|
||||
|
||||
* Added `owner_equals` to `shared_ptr`, `weak_ptr`, `local_shared_ptr`
|
||||
* Added `owner_equal_to`
|
||||
|
||||
## Changes in 1.72.0
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ This library provides six smart pointer class templates:
|
||||
* `<<scoped_ptr,scoped_ptr>>`, used to contain ownership of a dynamically allocated object to the current scope;
|
||||
* `<<scoped_array,scoped_array>>`, which provides scoped ownership for a dynamically allocated array;
|
||||
* `<<shared_ptr,shared_ptr>>`, a versatile tool for managing shared ownership of an object or array;
|
||||
* `<<weak_ptr,weak_ptr>>`, a non-owning observer to a shared_ptr-managed object that can be promoted temporarily to shared_ptr;
|
||||
* `<<weak_ptr,weak_ptr>>`, a non-owning observer to a `shared_ptr`-managed object that can be promoted temporarily to `shared_ptr`;
|
||||
* `<<intrusive_ptr,intrusive_ptr>>`, a pointer to objects with an embedded reference count;
|
||||
* `<<local_shared_ptr,local_shared_ptr>>`, providing shared ownership within a single thread.
|
||||
|
||||
@@ -39,10 +39,11 @@ This library provides six smart pointer class templates:
|
||||
|
||||
In addition, the library contains the following supporting utility functions and classes:
|
||||
|
||||
* `<<make_shared,make_shared>>`, a factory function for creating objects that returns a `shared_ptr`;
|
||||
* `<<make_shared,make_shared>>` and `allocate_shared`, factory functions for creating objects that return a `shared_ptr`;
|
||||
* `<<make_unique,make_unique>>`, a factory function returning `std::unique_ptr`;
|
||||
* `<<allocate_unique,allocate_unique>>`, a factory function for creating objects using an allocator that returns a `std::unique_ptr`;
|
||||
* `<<enable_shared_from_this,enable_shared_from_this>>`, a helper base class that enables the acquisition of a `shared_ptr` pointing to `this`;
|
||||
* `<<enable_shared_from,enable_shared_from>>`, a newer and better replacement for `enable_shared_from_this`;
|
||||
* `<<pointer_to_other,pointer_to_other>>`, a helper trait for converting one smart pointer type to another;
|
||||
* `<<pointer_cast,static_pointer_cast>>` and companions, generic smart pointer casts;
|
||||
* `<<intrusive_ref_counter,intrusive_ref_counter>>`, a helper base class containing a reference count.
|
||||
|
||||
45
doc/smart_ptr/owner_equal_to.adoc
Normal file
45
doc/smart_ptr/owner_equal_to.adoc
Normal file
@@ -0,0 +1,45 @@
|
||||
////
|
||||
Copyright 2020 Peter Dimov
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
https://www.boost.org/LICENSE_1_0.txt
|
||||
////
|
||||
|
||||
[#owner_equal_to]
|
||||
# owner_equal_to
|
||||
:toc:
|
||||
:toc-title:
|
||||
:idprefix: owner_equal_to_
|
||||
|
||||
## Description
|
||||
|
||||
`owner_equal_to<T>` is a helper function object that compares two smart
|
||||
pointer objects using `owner_equals`.
|
||||
|
||||
## Synopsis
|
||||
|
||||
`owner_equal_to` is defined in `<boost/smart_ptr/owner_equal_to.hpp>`.
|
||||
|
||||
```
|
||||
namespace boost {
|
||||
|
||||
template<class T = void> struct owner_equal_to
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef T first_argument_type;
|
||||
typedef T second_argument_type;
|
||||
|
||||
template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Members
|
||||
|
||||
```
|
||||
template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Returns::
|
||||
`u.owner_equals( v )`.
|
||||
50
doc/smart_ptr/owner_less.adoc
Normal file
50
doc/smart_ptr/owner_less.adoc
Normal file
@@ -0,0 +1,50 @@
|
||||
////
|
||||
Copyright 2020 Peter Dimov
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
https://www.boost.org/LICENSE_1_0.txt
|
||||
////
|
||||
|
||||
[#owner_less]
|
||||
# owner_less
|
||||
:toc:
|
||||
:toc-title:
|
||||
:idprefix: owner_less_
|
||||
|
||||
## Description
|
||||
|
||||
`owner_less<T>` is a helper function object that compares two smart
|
||||
pointer objects using `owner_before`. It is only provided for compatibility
|
||||
with {cpp}11 and corresponds to the standard component of the same name.
|
||||
|
||||
When using Boost smart pointers, the use of `owner_less` is unnecessary, as
|
||||
the supplied `operator<` overloads (and, correspondingly, `std::less`) return
|
||||
the same result.
|
||||
|
||||
## Synopsis
|
||||
|
||||
`owner_less` is defined in `<boost/smart_ptr/owner_less.hpp>`.
|
||||
|
||||
```
|
||||
namespace boost {
|
||||
|
||||
template<class T = void> struct owner_less
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef T first_argument_type;
|
||||
typedef T second_argument_type;
|
||||
|
||||
template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Members
|
||||
|
||||
```
|
||||
template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Returns::
|
||||
`u.owner_before( v )`.
|
||||
27
include/boost/smart_ptr/owner_equal_to.hpp
Normal file
27
include/boost/smart_ptr/owner_equal_to.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef BOOST_SMART_PTR_OWNER_EQUAL_TO_HPP_INCLUDED
|
||||
#define BOOST_SMART_PTR_OWNER_EQUAL_TO_HPP_INCLUDED
|
||||
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class T = void> struct owner_equal_to
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef T first_argument_type;
|
||||
typedef T second_argument_type;
|
||||
|
||||
template<class U, class V> bool operator()( U const & u, V const & v ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return u.owner_equals( v );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_OWNER_EQUAL_TO_HPP_INCLUDED
|
||||
@@ -14,6 +14,8 @@
|
||||
// See http://www.boost.org/libs/smart_ptr/ for documentation.
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -23,7 +25,7 @@ template<class T = void> struct owner_less
|
||||
typedef T first_argument_type;
|
||||
typedef T second_argument_type;
|
||||
|
||||
template<class U, class V> bool operator()( U const & u, V const & v ) const
|
||||
template<class U, class V> bool operator()( U const & u, V const & v ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return u.owner_before( v );
|
||||
}
|
||||
|
||||
@@ -371,3 +371,8 @@ run sp_owner_before_test.cpp ;
|
||||
run sp_owner_equals_test.cpp ;
|
||||
run lsp_owner_before_test.cpp ;
|
||||
run lsp_owner_equals_test.cpp ;
|
||||
|
||||
run owner_equal_to_test.cpp ;
|
||||
run owner_equal_to_test2.cpp ;
|
||||
|
||||
run owner_less_test2.cpp ;
|
||||
|
||||
116
test/owner_equal_to_test.cpp
Normal file
116
test/owner_equal_to_test.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/smart_ptr/owner_equal_to.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::owner_equal_to<> const eq = {};
|
||||
|
||||
{
|
||||
boost::shared_ptr<int> p1( new int );
|
||||
boost::shared_ptr<int> p2( p1 );
|
||||
|
||||
BOOST_TEST( eq( p1, p2 ) );
|
||||
BOOST_TEST( eq( p2, p1 ) );
|
||||
|
||||
boost::shared_ptr<int> p3( new int );
|
||||
|
||||
BOOST_TEST( !eq( p1, p3 ) );
|
||||
BOOST_TEST( !eq( p3, p1 ) );
|
||||
|
||||
boost::shared_ptr<int> p4;
|
||||
boost::shared_ptr<int> p5;
|
||||
|
||||
BOOST_TEST( eq( p4, p5 ) );
|
||||
BOOST_TEST( eq( p5, p4 ) );
|
||||
|
||||
BOOST_TEST( !eq( p4, p3 ) );
|
||||
BOOST_TEST( !eq( p3, p4 ) );
|
||||
|
||||
boost::shared_ptr<int> p6( static_cast<int*>(0) );
|
||||
|
||||
BOOST_TEST( !eq( p4, p6 ) );
|
||||
BOOST_TEST( !eq( p6, p4 ) );
|
||||
|
||||
boost::shared_ptr<void> p7( p1 );
|
||||
|
||||
BOOST_TEST( eq( p1, p7 ) );
|
||||
BOOST_TEST( eq( p7, p1 ) );
|
||||
|
||||
boost::shared_ptr<void> p8;
|
||||
|
||||
BOOST_TEST( !eq( p1, p8 ) );
|
||||
BOOST_TEST( !eq( p8, p1 ) );
|
||||
|
||||
BOOST_TEST( eq( p4, p8 ) );
|
||||
BOOST_TEST( eq( p8, p4 ) );
|
||||
|
||||
boost::weak_ptr<int> q1( p1 );
|
||||
|
||||
BOOST_TEST( eq( p1, q1 ) );
|
||||
BOOST_TEST( eq( q1, p1 ) );
|
||||
|
||||
boost::weak_ptr<int> q2( p1 );
|
||||
|
||||
BOOST_TEST( eq( q1, q2 ) );
|
||||
BOOST_TEST( eq( q2, q1 ) );
|
||||
|
||||
boost::weak_ptr<int> q3( p3 );
|
||||
|
||||
BOOST_TEST( !eq( p1, q3 ) );
|
||||
BOOST_TEST( !eq( q3, p1 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q3 ) );
|
||||
BOOST_TEST( !eq( q3, q1 ) );
|
||||
|
||||
boost::weak_ptr<int> q4;
|
||||
|
||||
BOOST_TEST( eq( p4, q4 ) );
|
||||
BOOST_TEST( eq( q4, p4 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q4 ) );
|
||||
BOOST_TEST( !eq( q4, q1 ) );
|
||||
|
||||
boost::weak_ptr<void> q5;
|
||||
|
||||
BOOST_TEST( eq( q4, q5 ) );
|
||||
BOOST_TEST( eq( q5, q4 ) );
|
||||
|
||||
boost::weak_ptr<void> q7( p7 );
|
||||
|
||||
BOOST_TEST( eq( p1, q7 ) );
|
||||
BOOST_TEST( eq( q7, p1 ) );
|
||||
|
||||
BOOST_TEST( eq( q1, q7 ) );
|
||||
BOOST_TEST( eq( q7, q1 ) );
|
||||
|
||||
p1.reset();
|
||||
p2.reset();
|
||||
p3.reset();
|
||||
p7.reset();
|
||||
|
||||
BOOST_TEST( q1.expired() );
|
||||
BOOST_TEST( q2.expired() );
|
||||
BOOST_TEST( q3.expired() );
|
||||
BOOST_TEST( q7.expired() );
|
||||
|
||||
BOOST_TEST( eq( q1, q2 ) );
|
||||
BOOST_TEST( eq( q2, q1 ) );
|
||||
|
||||
BOOST_TEST( eq( q1, q7 ) );
|
||||
BOOST_TEST( eq( q7, q1 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q3 ) );
|
||||
BOOST_TEST( !eq( q3, q1 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q4 ) );
|
||||
BOOST_TEST( !eq( q4, q1 ) );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
116
test/owner_equal_to_test2.cpp
Normal file
116
test/owner_equal_to_test2.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/smart_ptr/owner_equal_to.hpp>
|
||||
#include <boost/smart_ptr/local_shared_ptr.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::owner_equal_to<> const eq = {};
|
||||
|
||||
{
|
||||
boost::local_shared_ptr<int> p1( new int );
|
||||
boost::local_shared_ptr<int> p2( p1 );
|
||||
|
||||
BOOST_TEST( eq( p1, p2 ) );
|
||||
BOOST_TEST( eq( p2, p1 ) );
|
||||
|
||||
boost::local_shared_ptr<int> p3( new int );
|
||||
|
||||
BOOST_TEST( !eq( p1, p3 ) );
|
||||
BOOST_TEST( !eq( p3, p1 ) );
|
||||
|
||||
boost::local_shared_ptr<int> p4;
|
||||
boost::local_shared_ptr<int> p5;
|
||||
|
||||
BOOST_TEST( eq( p4, p5 ) );
|
||||
BOOST_TEST( eq( p5, p4 ) );
|
||||
|
||||
BOOST_TEST( !eq( p4, p3 ) );
|
||||
BOOST_TEST( !eq( p3, p4 ) );
|
||||
|
||||
boost::local_shared_ptr<int> p6( static_cast<int*>(0) );
|
||||
|
||||
BOOST_TEST( !eq( p4, p6 ) );
|
||||
BOOST_TEST( !eq( p6, p4 ) );
|
||||
|
||||
boost::local_shared_ptr<void> p7( p1 );
|
||||
|
||||
BOOST_TEST( eq( p1, p7 ) );
|
||||
BOOST_TEST( eq( p7, p1 ) );
|
||||
|
||||
boost::local_shared_ptr<void> p8;
|
||||
|
||||
BOOST_TEST( !eq( p1, p8 ) );
|
||||
BOOST_TEST( !eq( p8, p1 ) );
|
||||
|
||||
BOOST_TEST( eq( p4, p8 ) );
|
||||
BOOST_TEST( eq( p8, p4 ) );
|
||||
/*
|
||||
boost::local_weak_ptr<int> q1( p1 );
|
||||
|
||||
BOOST_TEST( eq( p1, q1 ) );
|
||||
BOOST_TEST( eq( q1, p1 ) );
|
||||
|
||||
boost::local_weak_ptr<int> q2( p1 );
|
||||
|
||||
BOOST_TEST( eq( q1, q2 ) );
|
||||
BOOST_TEST( eq( q2, q1 ) );
|
||||
|
||||
boost::local_weak_ptr<int> q3( p3 );
|
||||
|
||||
BOOST_TEST( !eq( p1, q3 ) );
|
||||
BOOST_TEST( !eq( q3, p1 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q3 ) );
|
||||
BOOST_TEST( !eq( q3, q1 ) );
|
||||
|
||||
boost::local_weak_ptr<int> q4;
|
||||
|
||||
BOOST_TEST( eq( p4, q4 ) );
|
||||
BOOST_TEST( eq( q4, p4 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q4 ) );
|
||||
BOOST_TEST( !eq( q4, q1 ) );
|
||||
|
||||
boost::local_weak_ptr<void> q5;
|
||||
|
||||
BOOST_TEST( eq( q4, q5 ) );
|
||||
BOOST_TEST( eq( q5, q4 ) );
|
||||
|
||||
boost::local_weak_ptr<void> q7( p7 );
|
||||
|
||||
BOOST_TEST( eq( p1, q7 ) );
|
||||
BOOST_TEST( eq( q7, p1 ) );
|
||||
|
||||
BOOST_TEST( eq( q1, q7 ) );
|
||||
BOOST_TEST( eq( q7, q1 ) );
|
||||
|
||||
p1.reset();
|
||||
p2.reset();
|
||||
p3.reset();
|
||||
p7.reset();
|
||||
|
||||
BOOST_TEST( q1.expired() );
|
||||
BOOST_TEST( q2.expired() );
|
||||
BOOST_TEST( q3.expired() );
|
||||
BOOST_TEST( q7.expired() );
|
||||
|
||||
BOOST_TEST( eq( q1, q2 ) );
|
||||
BOOST_TEST( eq( q2, q1 ) );
|
||||
|
||||
BOOST_TEST( eq( q1, q7 ) );
|
||||
BOOST_TEST( eq( q7, q1 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q3 ) );
|
||||
BOOST_TEST( !eq( q3, q1 ) );
|
||||
|
||||
BOOST_TEST( !eq( q1, q4 ) );
|
||||
BOOST_TEST( !eq( q4, q1 ) );
|
||||
*/
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
106
test/owner_less_test2.cpp
Normal file
106
test/owner_less_test2.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/smart_ptr/owner_less.hpp>
|
||||
#include <boost/smart_ptr/local_shared_ptr.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::owner_less<> const lt = {};
|
||||
|
||||
{
|
||||
boost::local_shared_ptr<int> p1( new int );
|
||||
boost::local_shared_ptr<int> p2( p1 );
|
||||
|
||||
BOOST_TEST( !lt( p1, p2 ) );
|
||||
BOOST_TEST( !lt( p2, p1 ) );
|
||||
|
||||
boost::local_shared_ptr<int> p3( new int );
|
||||
|
||||
BOOST_TEST( lt( p1, p3 ) || lt( p3, p1 ) );
|
||||
|
||||
boost::local_shared_ptr<int> p4;
|
||||
boost::local_shared_ptr<int> p5;
|
||||
|
||||
BOOST_TEST( !lt( p4, p5 ) );
|
||||
BOOST_TEST( !lt( p5, p4 ) );
|
||||
|
||||
BOOST_TEST( lt( p4, p3 ) || lt( p3, p4 ) );
|
||||
|
||||
boost::local_shared_ptr<int> p6( static_cast<int*>(0) );
|
||||
|
||||
BOOST_TEST( lt( p4, p6 ) || lt( p6, p4 ) );
|
||||
|
||||
boost::local_shared_ptr<void> p7( p1 );
|
||||
|
||||
BOOST_TEST( !lt( p1, p7 ) );
|
||||
BOOST_TEST( !lt( p7, p1 ) );
|
||||
|
||||
boost::local_shared_ptr<void> p8;
|
||||
|
||||
BOOST_TEST( lt( p1, p8 ) || lt( p8, p1 ) );
|
||||
|
||||
BOOST_TEST( !lt( p4, p8 ) );
|
||||
BOOST_TEST( !lt( p8, p4 ) );
|
||||
/*
|
||||
boost::local_weak_ptr<int> q1( p1 );
|
||||
|
||||
BOOST_TEST( !lt( p1, q1 ) );
|
||||
BOOST_TEST( !lt( q1, p1 ) );
|
||||
|
||||
boost::local_weak_ptr<int> q2( p1 );
|
||||
|
||||
BOOST_TEST( !lt( q1, q2 ) );
|
||||
BOOST_TEST( !lt( q2, q1 ) );
|
||||
|
||||
boost::local_weak_ptr<int> q3( p3 );
|
||||
|
||||
BOOST_TEST( lt( p1, q3 ) || lt( q3, p1 ) );
|
||||
BOOST_TEST( lt( q1, q3 ) || lt( q3, q1 ) );
|
||||
|
||||
boost::local_weak_ptr<int> q4;
|
||||
|
||||
BOOST_TEST( !lt( p4, q4 ) );
|
||||
BOOST_TEST( !lt( q4, p4 ) );
|
||||
|
||||
BOOST_TEST( lt( q1, q4 ) || lt( q4, q1 ) );
|
||||
|
||||
boost::local_weak_ptr<void> q5;
|
||||
|
||||
BOOST_TEST( !lt( q4, q5 ) );
|
||||
BOOST_TEST( !lt( q5, q4 ) );
|
||||
|
||||
boost::local_weak_ptr<void> q7( p7 );
|
||||
|
||||
BOOST_TEST( !lt( p1, q7 ) );
|
||||
BOOST_TEST( !lt( q7, p1 ) );
|
||||
|
||||
BOOST_TEST( !lt( q1, q7 ) );
|
||||
BOOST_TEST( !lt( q7, q1 ) );
|
||||
|
||||
p1.reset();
|
||||
p2.reset();
|
||||
p3.reset();
|
||||
p7.reset();
|
||||
|
||||
BOOST_TEST( q1.expired() );
|
||||
BOOST_TEST( q2.expired() );
|
||||
BOOST_TEST( q3.expired() );
|
||||
BOOST_TEST( q7.expired() );
|
||||
|
||||
BOOST_TEST( !lt( q1, q2 ) );
|
||||
BOOST_TEST( !lt( q2, q1 ) );
|
||||
|
||||
BOOST_TEST( !lt( q1, q7 ) );
|
||||
BOOST_TEST( !lt( q7, q1 ) );
|
||||
|
||||
BOOST_TEST( lt( q1, q3 ) || lt( q3, q1 ) );
|
||||
|
||||
BOOST_TEST( lt( q1, q4 ) || lt( q4, q1 ) );
|
||||
*/
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user