1 | #ifndef BOOST_OWNER_LESS_HPP_INCLUDED
|
---|
2 | #define BOOST_OWNER_LESS_HPP_INCLUDED
|
---|
3 |
|
---|
4 | //
|
---|
5 | // owner_less.hpp
|
---|
6 | //
|
---|
7 | // Copyright (c) 2008 Frank Mori Hess
|
---|
8 | //
|
---|
9 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
10 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
11 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
12 | //
|
---|
13 | // See http://www.boost.org/libs/smart_ptr/smart_ptr.htm for documentation.
|
---|
14 | //
|
---|
15 |
|
---|
16 | #include <functional>
|
---|
17 |
|
---|
18 | namespace boost
|
---|
19 | {
|
---|
20 | template<typename T> class shared_ptr;
|
---|
21 | template<typename T> class weak_ptr;
|
---|
22 |
|
---|
23 | namespace detail
|
---|
24 | {
|
---|
25 | template<typename T, typename U>
|
---|
26 | struct generic_owner_less : public std::binary_function<T, T, bool>
|
---|
27 | {
|
---|
28 | bool operator()(const T &lhs, const T &rhs) const
|
---|
29 | {
|
---|
30 | return lhs.owner_before(rhs);
|
---|
31 | }
|
---|
32 | bool operator()(const T &lhs, const U &rhs) const
|
---|
33 | {
|
---|
34 | return lhs.owner_before(rhs);
|
---|
35 | }
|
---|
36 | bool operator()(const U &lhs, const T &rhs) const
|
---|
37 | {
|
---|
38 | return lhs.owner_before(rhs);
|
---|
39 | }
|
---|
40 | };
|
---|
41 | } // namespace detail
|
---|
42 |
|
---|
43 | template<typename T> struct owner_less;
|
---|
44 |
|
---|
45 | template<typename T>
|
---|
46 | struct owner_less<shared_ptr<T> >:
|
---|
47 | public detail::generic_owner_less<shared_ptr<T>, weak_ptr<T> >
|
---|
48 | {};
|
---|
49 |
|
---|
50 | template<typename T>
|
---|
51 | struct owner_less<weak_ptr<T> >:
|
---|
52 | public detail::generic_owner_less<weak_ptr<T>, shared_ptr<T> >
|
---|
53 | {};
|
---|
54 |
|
---|
55 | } // namespace boost
|
---|
56 |
|
---|
57 | #endif // #ifndef BOOST_OWNER_LESS_HPP_INCLUDED
|
---|