]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/ptr_container/include/boost/ptr_container/ptr_set.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / ptr_container / include / boost / ptr_container / ptr_set.hpp
1 //
2 // Boost.Pointer Container
3 //
4 // Copyright Thorsten Ottosen 2003-2005. Use, modification and
5 // distribution is subject to the Boost Software License, Version
6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // For more information, see http://www.boost.org/libs/ptr_container/
10 //
11
12 #ifndef BOOST_PTR_CONTAINER_PTR_SET_HPP
13 #define BOOST_PTR_CONTAINER_PTR_SET_HPP
14
15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 # pragma once
17 #endif
18
19 #include <boost/ptr_container/indirect_fun.hpp>
20 #include <boost/ptr_container/ptr_set_adapter.hpp>
21 #include <set>
22
23 namespace boost
24 {
25
26 template
27 <
28 class Key,
29 class Compare = std::less<Key>,
30 class CloneAllocator = heap_clone_allocator,
31 class Allocator = std::allocator<void*>
32 >
33 class ptr_set :
34 public ptr_set_adapter< Key,
35 std::set<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
36 CloneAllocator, true >
37 {
38 typedef ptr_set_adapter< Key, std::set<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
39 CloneAllocator, true >
40 base_type;
41
42 typedef ptr_set<Key,Compare,CloneAllocator,Allocator> this_type;
43
44 public:
45 ptr_set()
46 { }
47
48 explicit ptr_set( const Compare& comp,
49 const Allocator& a = Allocator() )
50 : base_type( comp, a )
51 { }
52
53 template< typename InputIterator >
54 ptr_set( InputIterator first, InputIterator last )
55 : base_type( first, last )
56 { }
57
58 template< typename InputIterator >
59 ptr_set( InputIterator first, InputIterator last,
60 const Compare& comp,
61 const Allocator& a = Allocator() )
62 : base_type( first, last, comp, a )
63 { }
64
65 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set,
66 base_type,
67 this_type )
68
69 BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_set, base_type )
70
71 };
72
73
74
75 template
76 <
77 class Key,
78 class Compare = std::less<Key>,
79 class CloneAllocator = heap_clone_allocator,
80 class Allocator = std::allocator<void*>
81 >
82 class ptr_multiset :
83 public ptr_multiset_adapter< Key,
84 std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
85 CloneAllocator, true >
86 {
87 typedef ptr_multiset_adapter< Key,
88 std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
89 CloneAllocator, true >
90 base_type;
91 typedef ptr_multiset<Key,Compare,CloneAllocator,Allocator> this_type;
92
93 public:
94 ptr_multiset()
95 { }
96
97 explicit ptr_multiset( const Compare& comp,
98 const Allocator& a = Allocator() )
99 : base_type( comp, a )
100 { }
101
102 template< typename InputIterator >
103 ptr_multiset( InputIterator first, InputIterator last )
104 : base_type( first, last )
105 { }
106
107 template< typename InputIterator >
108 ptr_multiset( InputIterator first, InputIterator last,
109 const Compare& comp,
110 const Allocator& a = Allocator() )
111 : base_type( first, last, comp, a )
112 { }
113
114 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset,
115 base_type,
116 this_type )
117
118 BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_multiset,
119 base_type )
120
121 };
122
123 /////////////////////////////////////////////////////////////////////////
124 // clonability
125
126 template< typename K, typename C, typename CA, typename A >
127 inline ptr_set<K,C,CA,A>* new_clone( const ptr_set<K,C,CA,A>& r )
128 {
129 return r.clone().release();
130 }
131
132 template< typename K, typename C, typename CA, typename A >
133 inline ptr_multiset<K,C,CA,A>* new_clone( const ptr_multiset<K,C,CA,A>& r )
134 {
135 return r.clone().release();
136 }
137
138 /////////////////////////////////////////////////////////////////////////
139 // swap
140
141 template< typename K, typename C, typename CA, typename A >
142 inline void swap( ptr_set<K,C,CA,A>& l, ptr_set<K,C,CA,A>& r )
143 {
144 l.swap(r);
145 }
146
147 template< typename K, typename C, typename CA, typename A >
148 inline void swap( ptr_multiset<K,C,CA,A>& l, ptr_multiset<K,C,CA,A>& r )
149 {
150 l.swap(r);
151 }
152
153 }
154
155 #endif