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_MAP_HPP
13 #define BOOST_PTR_CONTAINER_PTR_MAP_HPP
15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
20 #include <boost/ptr_container/ptr_map_adapter.hpp>
29 class Compare = std::less<Key>,
30 class CloneAllocator = heap_clone_allocator,
31 class Allocator = std::allocator< std::pair<const Key,void*> >
34 public ptr_map_adapter<T,std::map<Key,void*,
35 Compare,Allocator>,CloneAllocator>
37 typedef ptr_map_adapter<T,std::map<Key,void*,
38 Compare,Allocator>,CloneAllocator>
41 typedef ptr_map<Key,T,Compare,CloneAllocator,Allocator> this_type;
44 explicit ptr_map( const Compare& comp = Compare(),
45 const Allocator& a = Allocator() )
46 : base_type( comp, a ) { }
48 template< class InputIterator >
49 ptr_map( InputIterator first, InputIterator last,
50 const Compare& comp = Compare(),
51 const Allocator& a = Allocator() )
52 : base_type( first, last, comp, a )
55 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type,
66 class Compare = std::less<Key>,
67 class CloneAllocator = heap_clone_allocator,
68 class Allocator = std::allocator< std::pair<const Key,void*> >
71 public ptr_multimap_adapter<T,std::multimap<Key,void*,
72 Compare,Allocator>,CloneAllocator>
74 typedef ptr_multimap_adapter<T,std::multimap<Key,void*,
75 Compare,Allocator>,CloneAllocator>
78 typedef ptr_multimap<Key,T,Compare,CloneAllocator,Allocator> this_type;
81 explicit ptr_multimap( const Compare& comp = Compare(),
82 const Allocator& a = Allocator() )
83 : base_type( comp, a ) { }
85 template< class InputIterator >
86 ptr_multimap( InputIterator first, InputIterator last,
87 const Compare& comp = Compare(),
88 const Allocator& a = Allocator() )
89 : base_type( first, last, comp, a )
92 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap,
98 //////////////////////////////////////////////////////////////////////////////
101 template< class K, class T, class C, class CA, class A >
102 inline ptr_map<K,T,C,CA,A>* new_clone( const ptr_map<K,T,C,CA,A>& r )
104 return r.clone().release();
107 template< class K, class T, class C, class CA, class A >
108 inline ptr_multimap<K,T,C,CA,A>* new_clone( const ptr_multimap<K,T,C,CA,A>& r )
110 return r.clone().release();
113 /////////////////////////////////////////////////////////////////////////
116 template< typename K, typename T, typename C, typename CA, typename A >
117 inline void swap( ptr_map<K,T,C,CA,A>& l, ptr_map<K,T,C,CA,A>& r )
122 template< typename K, typename T, typename C, typename CA, typename A >
123 inline void swap( ptr_multimap<K,T,C,CA,A>& l, ptr_multimap<K,T,C,CA,A>& r )