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