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>,
38 typedef ptr_set_adapter< Key, std::set<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
42 typedef ptr_set<Key,Compare,CloneAllocator,Allocator> this_type;
45 explicit ptr_set( const Compare& comp = Compare(),
46 const Allocator& a = Allocator() )
47 : base_type( comp, a )
50 template< typename InputIterator >
51 ptr_set( InputIterator first, InputIterator last,
52 const Compare& comp = Compare(),
53 const Allocator& a = Allocator() )
54 : base_type( first, last, comp, a )
57 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set,
68 class Compare = std::less<Key>,
69 class CloneAllocator = heap_clone_allocator,
70 class Allocator = std::allocator<void*>
73 public ptr_multiset_adapter< Key,
74 std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
77 typedef ptr_multiset_adapter< Key,
78 std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
81 typedef ptr_multiset<Key,Compare,CloneAllocator,Allocator> this_type;
84 explicit ptr_multiset( const Compare& comp = Compare(),
85 const Allocator& a = Allocator() )
86 : base_type( comp, a )
89 template< typename InputIterator >
90 ptr_multiset( InputIterator first, InputIterator last,
91 const Compare& comp = Compare(),
92 const Allocator& a = Allocator() )
93 : base_type( first, last, comp, a )
96 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset,
102 /////////////////////////////////////////////////////////////////////////
105 template< typename K, typename C, typename CA, typename A >
106 inline ptr_set<K,C,CA,A>* new_clone( const ptr_set<K,C,CA,A>& r )
108 return r.clone().release();
111 template< typename K, typename C, typename CA, typename A >
112 inline ptr_multiset<K,C,CA,A>* new_clone( const ptr_multiset<K,C,CA,A>& r )
114 return r.clone().release();
117 /////////////////////////////////////////////////////////////////////////
120 template< typename K, typename C, typename CA, typename A >
121 inline void swap( ptr_set<K,C,CA,A>& l, ptr_set<K,C,CA,A>& r )
126 template< typename K, typename C, typename CA, typename A >
127 inline void swap( ptr_multiset<K,C,CA,A>& l, ptr_multiset<K,C,CA,A>& r )