2 // Boost.Pointer Container
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)
9 // For more information, see http://www.boost.org/libs/ptr_container/
12 #ifndef BOOST_PTR_CONTAINER_PTR_SET_HPP
13 #define BOOST_PTR_CONTAINER_PTR_SET_HPP
15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
19 #include <boost/ptr_container/indirect_fun.hpp>
20 #include <boost/ptr_container/ptr_set_adapter.hpp>
29 class Compare
= std::less
<Key
>,
30 class CloneAllocator
= heap_clone_allocator
,
31 class Allocator
= std::allocator
<void*>
34 public ptr_set_adapter
< Key
,
35 std::set
<void*,void_ptr_indirect_fun
<Compare
,Key
>,Allocator
>,
36 CloneAllocator
, true >
38 typedef ptr_set_adapter
< Key
, std::set
<void*,void_ptr_indirect_fun
<Compare
,Key
>,Allocator
>,
39 CloneAllocator
, true >
42 typedef ptr_set
<Key
,Compare
,CloneAllocator
,Allocator
> this_type
;
48 explicit ptr_set( const Compare
& comp
,
49 const Allocator
& a
= Allocator() )
50 : base_type( comp
, a
)
53 template< typename InputIterator
>
54 ptr_set( InputIterator first
, InputIterator last
)
55 : base_type( first
, last
)
58 template< typename InputIterator
>
59 ptr_set( InputIterator first
, InputIterator last
,
61 const Allocator
& a
= Allocator() )
62 : base_type( first
, last
, comp
, a
)
65 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set
,
69 BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_set
, base_type
)
78 class Compare
= std::less
<Key
>,
79 class CloneAllocator
= heap_clone_allocator
,
80 class Allocator
= std::allocator
<void*>
83 public ptr_multiset_adapter
< Key
,
84 std::multiset
<void*,void_ptr_indirect_fun
<Compare
,Key
>,Allocator
>,
85 CloneAllocator
, true >
87 typedef ptr_multiset_adapter
< Key
,
88 std::multiset
<void*,void_ptr_indirect_fun
<Compare
,Key
>,Allocator
>,
89 CloneAllocator
, true >
91 typedef ptr_multiset
<Key
,Compare
,CloneAllocator
,Allocator
> this_type
;
97 explicit ptr_multiset( const Compare
& comp
,
98 const Allocator
& a
= Allocator() )
99 : base_type( comp
, a
)
102 template< typename InputIterator
>
103 ptr_multiset( InputIterator first
, InputIterator last
)
104 : base_type( first
, last
)
107 template< typename InputIterator
>
108 ptr_multiset( InputIterator first
, InputIterator last
,
110 const Allocator
& a
= Allocator() )
111 : base_type( first
, last
, comp
, a
)
114 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset
,
118 BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_multiset
,
123 /////////////////////////////////////////////////////////////////////////
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
)
129 return r
.clone().release();
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
)
135 return r
.clone().release();
138 /////////////////////////////////////////////////////////////////////////
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
)
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
)