Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:36

0001 //
0002 // Boost.Pointer Container
0003 //
0004 //  Copyright Thorsten Ottosen 2008. Use, modification and
0005 //  distribution is subject to the Boost Software License, Version
0006 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 //  http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // For more information, see http://www.boost.org/libs/ptr_container/
0010 //
0011 
0012 #ifndef BOOST_PTR_CONTAINER_PTR_UNORDERED_MAP_HPP
0013 #define BOOST_PTR_CONTAINER_PTR_UNORDERED_MAP_HPP
0014 
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018 
0019 #include <boost/unordered_map.hpp>
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 Hash           = boost::hash<Key>,
0036         class Pred           = std::equal_to<Key>,
0037         class CloneAllocator = heap_clone_allocator,
0038         class Allocator      = std::allocator< std::pair<const Key,
0039                            typename ptr_container_detail::void_ptr<T>::type> >
0040     >
0041     class ptr_unordered_map :
0042         public ptr_map_adapter<T,boost::unordered_map<Key,
0043             typename ptr_container_detail::void_ptr<T>::type,Hash,Pred,Allocator>,
0044                                CloneAllocator,false>
0045     {
0046         typedef ptr_map_adapter<T,boost::unordered_map<Key,
0047             typename ptr_container_detail::void_ptr<T>::type,Hash,Pred,Allocator>,
0048                                CloneAllocator,false>
0049             base_type;
0050 
0051         typedef ptr_unordered_map<Key,T,Hash,Pred,CloneAllocator,Allocator> this_type;
0052 
0053     public:
0054         typedef typename base_type::size_type size_type;
0055 
0056     private:
0057         using base_type::lower_bound;
0058         using base_type::upper_bound;
0059         using base_type::rbegin;
0060         using base_type::rend;
0061         using base_type::crbegin;
0062         using base_type::crend;
0063         using base_type::key_comp;
0064         using base_type::value_comp;
0065         using base_type::front;
0066         using base_type::back;
0067 
0068     public:
0069         using base_type::begin;
0070         using base_type::end;
0071         using base_type::cbegin;
0072         using base_type::cend;
0073         using base_type::bucket_count;
0074         using base_type::max_bucket_count;
0075         using base_type::bucket_size;
0076         using base_type::bucket;
0077         using base_type::load_factor;
0078         using base_type::max_load_factor;
0079         using base_type::rehash;
0080         using base_type::key_eq;
0081         using base_type::hash_function;
0082 
0083     public:
0084         ptr_unordered_map()
0085         { }
0086 
0087         explicit ptr_unordered_map( size_type n )
0088         : base_type( n, ptr_container_detail::unordered_associative_container_tag() )
0089         { }
0090 
0091         ptr_unordered_map( size_type n,
0092                            const Hash& comp,
0093                            const Pred& pred   = Pred(),
0094                            const Allocator& a = Allocator() )
0095          : base_type( n, comp, pred, a )
0096         { }
0097 
0098         template< typename InputIterator >
0099         ptr_unordered_map( InputIterator first, InputIterator last )
0100          : base_type( first, last )
0101         { }
0102 
0103         template< typename InputIterator >
0104         ptr_unordered_map( InputIterator first, InputIterator last,
0105                            const Hash& comp,
0106                            const Pred& pred   = Pred(),
0107                            const Allocator& a = Allocator() )
0108          : base_type( first, last, comp, pred, a )
0109         { }
0110 
0111         BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_map,
0112                                                       base_type,
0113                                                       this_type )
0114 
0115         template< class U >
0116         ptr_unordered_map( const ptr_unordered_map<Key,U>& r ) : base_type( r )
0117         { }
0118 
0119         ptr_unordered_map& operator=( ptr_unordered_map r )
0120         {
0121             this->swap( r );
0122             return *this;
0123         }
0124     };
0125 
0126 
0127 
0128     template
0129     <
0130         class Key,
0131         class T,
0132         class Hash           = boost::hash<Key>,
0133         class Pred           = std::equal_to<Key>,
0134         class CloneAllocator = heap_clone_allocator,
0135         class Allocator      = std::allocator< std::pair<const Key,void*> >
0136     >
0137     class ptr_unordered_multimap :
0138         public ptr_multimap_adapter<T,boost::unordered_multimap<Key,void*,Hash,Pred,Allocator>,
0139                                     CloneAllocator,false>
0140     {
0141         typedef ptr_multimap_adapter<T,boost::unordered_multimap<Key,void*,Hash,Pred,Allocator>,
0142                                      CloneAllocator,false>
0143             base_type;
0144 
0145         typedef ptr_unordered_multimap<Key,T,Hash,Pred,CloneAllocator,Allocator> this_type;
0146 
0147     public:
0148         typedef typename base_type::size_type size_type;
0149 
0150     private:
0151         using base_type::lower_bound;
0152         using base_type::upper_bound;
0153         using base_type::rbegin;
0154         using base_type::rend;
0155         using base_type::crbegin;
0156         using base_type::crend;
0157         using base_type::key_comp;
0158         using base_type::value_comp;
0159         using base_type::front;
0160         using base_type::back;
0161 
0162     public:
0163         using base_type::begin;
0164         using base_type::end;
0165         using base_type::cbegin;
0166         using base_type::cend;
0167         using base_type::bucket_count;
0168         using base_type::max_bucket_count;
0169         using base_type::bucket_size;
0170         using base_type::bucket;
0171         using base_type::load_factor;
0172         using base_type::max_load_factor;
0173         using base_type::rehash;
0174         using base_type::key_eq;
0175         using base_type::hash_function;
0176 
0177     public:
0178         ptr_unordered_multimap()
0179         { }
0180 
0181         explicit ptr_unordered_multimap( size_type n )
0182         : base_type( n, ptr_container_detail::unordered_associative_container_tag() )
0183         { }
0184 
0185         ptr_unordered_multimap( size_type n,
0186                                 const Hash& comp,
0187                                 const Pred& pred   = Pred(),
0188                                 const Allocator& a = Allocator() )
0189          : base_type( n, comp, pred, a )
0190         { }
0191 
0192         template< typename InputIterator >
0193         ptr_unordered_multimap( InputIterator first, InputIterator last )
0194          : base_type( first, last )
0195         { }
0196 
0197         template< typename InputIterator >
0198         ptr_unordered_multimap( InputIterator first, InputIterator last,
0199                                 const Hash& comp,
0200                                 const Pred& pred   = Pred(),
0201                                 const Allocator& a = Allocator() )
0202          : base_type( first, last, comp, pred, a )
0203         { }
0204 
0205         BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multimap,
0206                                                       base_type,
0207                                                       this_type )
0208 
0209         template< class U >
0210         ptr_unordered_multimap( const ptr_unordered_multimap<Key,U>& r ) : base_type( r )
0211         { }
0212 
0213         ptr_unordered_multimap& operator=( ptr_unordered_multimap r )
0214         {
0215             this->swap( r );
0216             return *this;
0217         }
0218     };
0219 
0220     //////////////////////////////////////////////////////////////////////////////
0221     // clonability
0222 
0223     template< class K, class T, class H, class P, class CA, class A >
0224     inline ptr_unordered_map<K,T,H,P,CA,A>*
0225     new_clone( const ptr_unordered_map<K,T,H,P,CA,A>& r )
0226     {
0227         return r.clone().release();
0228     }
0229 
0230     template< class K, class T, class H, class P, class CA, class A >
0231     inline ptr_unordered_multimap<K,T,H,P,CA,A>*
0232     new_clone( const ptr_unordered_multimap<K,T,H,P,CA,A>& r )
0233     {
0234         return r.clone().release();
0235     }
0236 
0237     /////////////////////////////////////////////////////////////////////////
0238     // swap
0239 
0240     template< class K, class T, class H, class P, class CA, class A >
0241     inline void swap( ptr_unordered_map<K,T,H,P,CA,A>& l,
0242                       ptr_unordered_map<K,T,H,P,CA,A>& r )
0243     {
0244         l.swap(r);
0245     }
0246 
0247     template< class K, class T, class H, class P, class CA, class A >
0248     inline void swap( ptr_unordered_multimap<K,T,H,P,CA,A>& l,
0249                       ptr_unordered_multimap<K,T,H,P,CA,A>& r )
0250     {
0251         l.swap(r);
0252     }
0253 
0254 
0255 }
0256 
0257 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0258 #pragma GCC diagnostic pop
0259 #endif
0260 
0261 #endif