File indexing completed on 2025-01-18 09:50:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_PTR_CONTAINER_PTR_MAP_HPP
0013 #define BOOST_PTR_CONTAINER_PTR_MAP_HPP
0014
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018
0019 #include <map>
0020 #include <boost/ptr_container/ptr_map_adapter.hpp>
0021 #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
0022
0023 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0024 #pragma GCC diagnostic push
0025 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0026 #endif
0027
0028 namespace boost
0029 {
0030
0031 template
0032 <
0033 class Key,
0034 class T,
0035 class Compare = std::less<Key>,
0036 class CloneAllocator = heap_clone_allocator,
0037 class Allocator = std::allocator< std::pair<const Key,typename ptr_container_detail::void_ptr<T>::type> >
0038 >
0039 class ptr_map :
0040 public ptr_map_adapter<T,std::map<Key,
0041 typename ptr_container_detail::void_ptr<T>::type,
0042 Compare,Allocator>,CloneAllocator>
0043 {
0044 typedef ptr_map_adapter<T,std::map<Key,
0045 typename ptr_container_detail::void_ptr<T>::type,
0046 Compare,Allocator>,CloneAllocator>
0047 base_type;
0048
0049 typedef ptr_map<Key,T,Compare,CloneAllocator,Allocator> this_type;
0050
0051 public:
0052 ptr_map()
0053 { }
0054
0055 explicit ptr_map( const Compare& comp,
0056 const Allocator& a = Allocator() )
0057 : base_type( comp, a ) { }
0058
0059 template< class InputIterator >
0060 ptr_map( InputIterator first, InputIterator last )
0061 : base_type( first, last )
0062 { }
0063
0064 template< class InputIterator >
0065 ptr_map( InputIterator first, InputIterator last,
0066 const Compare& comp,
0067 const Allocator& a = Allocator() )
0068 : base_type( first, last, comp, a )
0069 { }
0070
0071 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type,
0072 this_type )
0073
0074 template< class U >
0075 ptr_map( const ptr_map<Key,U>& r ) : base_type( r )
0076 { }
0077
0078 ptr_map& operator=( ptr_map r )
0079 {
0080 this->swap( r );
0081 return *this;
0082 }
0083 };
0084
0085
0086
0087 template
0088 <
0089 class Key,
0090 class T,
0091 class Compare = std::less<Key>,
0092 class CloneAllocator = heap_clone_allocator,
0093 class Allocator = std::allocator< std::pair<const Key,void*> >
0094 >
0095 class ptr_multimap :
0096 public ptr_multimap_adapter<T,std::multimap<Key,void*,
0097 Compare,Allocator>,CloneAllocator>
0098 {
0099 typedef ptr_multimap_adapter<T,std::multimap<Key,void*,
0100 Compare,Allocator>,CloneAllocator>
0101 base_type;
0102
0103 typedef ptr_multimap<Key,T,Compare,CloneAllocator,Allocator> this_type;
0104
0105 public:
0106 ptr_multimap()
0107 { }
0108
0109 explicit ptr_multimap( const Compare& comp,
0110 const Allocator& a = Allocator() )
0111 : base_type( comp, a ) { }
0112
0113 template< class InputIterator >
0114 ptr_multimap( InputIterator first, InputIterator last )
0115 : base_type( first, last )
0116 { }
0117
0118 template< class InputIterator >
0119 ptr_multimap( InputIterator first, InputIterator last,
0120 const Compare& comp,
0121 const Allocator& a = Allocator() )
0122 : base_type( first, last, comp, a )
0123 { }
0124
0125 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap,
0126 base_type,
0127 this_type )
0128
0129 template< class U >
0130 ptr_multimap( const ptr_multimap<Key,U>& r ) : base_type( r )
0131 { }
0132
0133 ptr_multimap& operator=( ptr_multimap r )
0134 {
0135 this->swap( r );
0136 return *this;
0137 }
0138 };
0139
0140
0141
0142
0143 template< class K, class T, class C, class CA, class A >
0144 inline ptr_map<K,T,C,CA,A>* new_clone( const ptr_map<K,T,C,CA,A>& r )
0145 {
0146 return r.clone().release();
0147 }
0148
0149 template< class K, class T, class C, class CA, class A >
0150 inline ptr_multimap<K,T,C,CA,A>* new_clone( const ptr_multimap<K,T,C,CA,A>& r )
0151 {
0152 return r.clone().release();
0153 }
0154
0155
0156
0157
0158 template< typename K, typename T, typename C, typename CA, typename A >
0159 inline void swap( ptr_map<K,T,C,CA,A>& l, ptr_map<K,T,C,CA,A>& r )
0160 {
0161 l.swap(r);
0162 }
0163
0164 template< typename K, typename T, typename C, typename CA, typename A >
0165 inline void swap( ptr_multimap<K,T,C,CA,A>& l, ptr_multimap<K,T,C,CA,A>& r )
0166 {
0167 l.swap(r);
0168 }
0169
0170
0171 }
0172
0173 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0174 #pragma GCC diagnostic pop
0175 #endif
0176
0177 #endif