annotate DEPENDENCIES/generic/include/boost/ptr_container/ptr_map.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 //
Chris@16 2 // Boost.Pointer Container
Chris@16 3 //
Chris@16 4 // Copyright Thorsten Ottosen 2003-2005. Use, modification and
Chris@16 5 // distribution is subject to the Boost Software License, Version
Chris@16 6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8 //
Chris@16 9 // For more information, see http://www.boost.org/libs/ptr_container/
Chris@16 10 //
Chris@16 11
Chris@16 12 #ifndef BOOST_PTR_CONTAINER_PTR_MAP_HPP
Chris@16 13 #define BOOST_PTR_CONTAINER_PTR_MAP_HPP
Chris@16 14
Chris@16 15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 16 # pragma once
Chris@16 17 #endif
Chris@16 18
Chris@16 19 #include <map>
Chris@16 20 #include <boost/ptr_container/ptr_map_adapter.hpp>
Chris@16 21
Chris@16 22 namespace boost
Chris@16 23 {
Chris@16 24
Chris@16 25 template
Chris@16 26 <
Chris@16 27 class Key,
Chris@16 28 class T,
Chris@16 29 class Compare = std::less<Key>,
Chris@16 30 class CloneAllocator = heap_clone_allocator,
Chris@16 31 class Allocator = std::allocator< std::pair<const Key,void*> >
Chris@16 32 >
Chris@16 33 class ptr_map :
Chris@16 34 public ptr_map_adapter<T,std::map<Key,void*,
Chris@16 35 Compare,Allocator>,CloneAllocator>
Chris@16 36 {
Chris@16 37 typedef ptr_map_adapter<T,std::map<Key,void*,
Chris@16 38 Compare,Allocator>,CloneAllocator>
Chris@16 39 base_type;
Chris@16 40
Chris@16 41 typedef ptr_map<Key,T,Compare,CloneAllocator,Allocator> this_type;
Chris@16 42
Chris@16 43 public:
Chris@16 44 ptr_map()
Chris@16 45 { }
Chris@16 46
Chris@16 47 explicit ptr_map( const Compare& comp,
Chris@16 48 const Allocator& a = Allocator() )
Chris@16 49 : base_type( comp, a ) { }
Chris@16 50
Chris@16 51 template< class InputIterator >
Chris@16 52 ptr_map( InputIterator first, InputIterator last )
Chris@16 53 : base_type( first, last )
Chris@16 54 { }
Chris@16 55
Chris@16 56 template< class InputIterator >
Chris@16 57 ptr_map( InputIterator first, InputIterator last,
Chris@16 58 const Compare& comp,
Chris@16 59 const Allocator& a = Allocator() )
Chris@16 60 : base_type( first, last, comp, a )
Chris@16 61 { }
Chris@16 62
Chris@16 63 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type,
Chris@16 64 this_type )
Chris@16 65
Chris@16 66 template< class U >
Chris@16 67 ptr_map( const ptr_map<Key,U>& r ) : base_type( r )
Chris@16 68 { }
Chris@16 69
Chris@16 70 ptr_map& operator=( ptr_map r )
Chris@16 71 {
Chris@16 72 this->swap( r );
Chris@16 73 return *this;
Chris@16 74 }
Chris@16 75 };
Chris@16 76
Chris@16 77
Chris@16 78
Chris@16 79 template
Chris@16 80 <
Chris@16 81 class Key,
Chris@16 82 class T,
Chris@16 83 class Compare = std::less<Key>,
Chris@16 84 class CloneAllocator = heap_clone_allocator,
Chris@16 85 class Allocator = std::allocator< std::pair<const Key,void*> >
Chris@16 86 >
Chris@16 87 class ptr_multimap :
Chris@16 88 public ptr_multimap_adapter<T,std::multimap<Key,void*,
Chris@16 89 Compare,Allocator>,CloneAllocator>
Chris@16 90 {
Chris@16 91 typedef ptr_multimap_adapter<T,std::multimap<Key,void*,
Chris@16 92 Compare,Allocator>,CloneAllocator>
Chris@16 93 base_type;
Chris@16 94
Chris@16 95 typedef ptr_multimap<Key,T,Compare,CloneAllocator,Allocator> this_type;
Chris@16 96
Chris@16 97 public:
Chris@16 98 ptr_multimap()
Chris@16 99 { }
Chris@16 100
Chris@16 101 explicit ptr_multimap( const Compare& comp,
Chris@16 102 const Allocator& a = Allocator() )
Chris@16 103 : base_type( comp, a ) { }
Chris@16 104
Chris@16 105 template< class InputIterator >
Chris@16 106 ptr_multimap( InputIterator first, InputIterator last )
Chris@16 107 : base_type( first, last )
Chris@16 108 { }
Chris@16 109
Chris@16 110 template< class InputIterator >
Chris@16 111 ptr_multimap( InputIterator first, InputIterator last,
Chris@16 112 const Compare& comp,
Chris@16 113 const Allocator& a = Allocator() )
Chris@16 114 : base_type( first, last, comp, a )
Chris@16 115 { }
Chris@16 116
Chris@16 117 BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap,
Chris@16 118 base_type,
Chris@16 119 this_type )
Chris@16 120
Chris@16 121 template< class U >
Chris@16 122 ptr_multimap( const ptr_multimap<Key,U>& r ) : base_type( r )
Chris@16 123 { }
Chris@16 124
Chris@16 125 ptr_multimap& operator=( ptr_multimap r )
Chris@16 126 {
Chris@16 127 this->swap( r );
Chris@16 128 return *this;
Chris@16 129 }
Chris@16 130 };
Chris@16 131
Chris@16 132 //////////////////////////////////////////////////////////////////////////////
Chris@16 133 // clonability
Chris@16 134
Chris@16 135 template< class K, class T, class C, class CA, class A >
Chris@16 136 inline ptr_map<K,T,C,CA,A>* new_clone( const ptr_map<K,T,C,CA,A>& r )
Chris@16 137 {
Chris@16 138 return r.clone().release();
Chris@16 139 }
Chris@16 140
Chris@16 141 template< class K, class T, class C, class CA, class A >
Chris@16 142 inline ptr_multimap<K,T,C,CA,A>* new_clone( const ptr_multimap<K,T,C,CA,A>& r )
Chris@16 143 {
Chris@16 144 return r.clone().release();
Chris@16 145 }
Chris@16 146
Chris@16 147 /////////////////////////////////////////////////////////////////////////
Chris@16 148 // swap
Chris@16 149
Chris@16 150 template< typename K, typename T, typename C, typename CA, typename A >
Chris@16 151 inline void swap( ptr_map<K,T,C,CA,A>& l, ptr_map<K,T,C,CA,A>& r )
Chris@16 152 {
Chris@16 153 l.swap(r);
Chris@16 154 }
Chris@16 155
Chris@16 156 template< typename K, typename T, typename C, typename CA, typename A >
Chris@16 157 inline void swap( ptr_multimap<K,T,C,CA,A>& l, ptr_multimap<K,T,C,CA,A>& r )
Chris@16 158 {
Chris@16 159 l.swap(r);
Chris@16 160 }
Chris@16 161
Chris@16 162
Chris@16 163 }
Chris@16 164
Chris@16 165 #endif