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_SET_HPP
0013 #define BOOST_PTR_CONTAINER_PTR_UNORDERED_SET_HPP
0014 
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018 
0019 #include <boost/ptr_container/indirect_fun.hpp>
0020 #include <boost/ptr_container/ptr_set_adapter.hpp>
0021 #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
0022 #include <boost/unordered_set.hpp>
0023 
0024 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0025 #pragma GCC diagnostic push
0026 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0027 #endif
0028 
0029 namespace boost
0030 {
0031 
0032     template
0033     <
0034         class Key,
0035         class Hash           = boost::hash<Key>,
0036         class Pred           = std::equal_to<Key>,
0037         class CloneAllocator = heap_clone_allocator,
0038         class Allocator      = std::allocator< typename ptr_container_detail::void_ptr<Key>::type >
0039     >
0040     class ptr_unordered_set :
0041         public ptr_set_adapter< Key, boost::unordered_set<
0042             typename ptr_container_detail::void_ptr<Key>::type,
0043             void_ptr_indirect_fun<Hash,Key>,
0044             void_ptr_indirect_fun<Pred,Key>,Allocator>,
0045                                 CloneAllocator, false >
0046     {
0047         typedef ptr_set_adapter< Key, boost::unordered_set<
0048                            typename ptr_container_detail::void_ptr<Key>::type,
0049                                  void_ptr_indirect_fun<Hash,Key>,
0050                                  void_ptr_indirect_fun<Pred,Key>,Allocator>,
0051                                  CloneAllocator, false >
0052              base_type;
0053 
0054         typedef ptr_unordered_set<Key,Hash,Pred,CloneAllocator,Allocator> this_type;
0055 
0056     public:
0057         typedef typename base_type::size_type size_type;
0058 
0059     private:
0060         using base_type::lower_bound;
0061         using base_type::upper_bound;
0062         using base_type::rbegin;
0063         using base_type::rend;
0064         using base_type::crbegin;
0065         using base_type::crend;
0066         using base_type::key_comp;
0067         using base_type::value_comp;
0068         using base_type::front;
0069         using base_type::back;
0070 
0071     public:
0072         using base_type::begin;
0073         using base_type::end;
0074         using base_type::cbegin;
0075         using base_type::cend;
0076         using base_type::bucket_count;
0077         using base_type::max_bucket_count;
0078         using base_type::bucket_size;
0079         using base_type::bucket;
0080         using base_type::load_factor;
0081         using base_type::max_load_factor;
0082         using base_type::rehash;
0083         using base_type::key_eq;
0084         using base_type::hash_function;
0085 
0086     public:
0087         ptr_unordered_set()
0088         {}
0089 
0090         explicit ptr_unordered_set( size_type n )
0091         : base_type( n, ptr_container_detail::unordered_associative_container_tag() )
0092         { }
0093 
0094         ptr_unordered_set( size_type n,
0095                            const Hash& comp,
0096                            const Pred& pred   = Pred(),
0097                            const Allocator& a = Allocator() )
0098          : base_type( n, comp, pred, a )
0099         { }
0100 
0101         template< typename InputIterator >
0102         ptr_unordered_set( InputIterator first, InputIterator last )
0103          : base_type( first, last )
0104         { }
0105 
0106         template< typename InputIterator >
0107         ptr_unordered_set( InputIterator first, InputIterator last,
0108                            const Hash& comp,
0109                            const Pred& pred   = Pred(),
0110                            const Allocator& a = Allocator() )
0111          : base_type( first, last, comp, pred, a )
0112         { }
0113 
0114         BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_set,
0115                                                       base_type,
0116                                                       this_type )
0117 
0118         BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_set,
0119                                                       base_type )
0120 
0121     };
0122 
0123 
0124     template
0125     <
0126         class Key,
0127         class Hash           = boost::hash<Key>,
0128         class Pred           = std::equal_to<Key>,
0129         class CloneAllocator = heap_clone_allocator,
0130         class Allocator      = std::allocator<void*>
0131     >
0132     class ptr_unordered_multiset :
0133           public ptr_multiset_adapter< Key,
0134                                 boost::unordered_multiset<void*,void_ptr_indirect_fun<Hash,Key>,
0135                                                                 void_ptr_indirect_fun<Pred,Key>,Allocator>,
0136                                             CloneAllocator, false >
0137     {
0138       typedef ptr_multiset_adapter< Key,
0139               boost::unordered_multiset<void*,void_ptr_indirect_fun<Hash,Key>,
0140                                         void_ptr_indirect_fun<Pred,Key>,Allocator>,
0141                                         CloneAllocator, false >
0142               base_type;
0143         typedef ptr_unordered_multiset<Key,Hash,Pred,CloneAllocator,Allocator> this_type;
0144 
0145     public:
0146         typedef typename base_type::size_type size_type;
0147 
0148     private:
0149         using base_type::lower_bound;
0150         using base_type::upper_bound;
0151         using base_type::rbegin;
0152         using base_type::rend;
0153         using base_type::crbegin;
0154         using base_type::crend;
0155         using base_type::key_comp;
0156         using base_type::value_comp;
0157         using base_type::front;
0158         using base_type::back;
0159 
0160     public:
0161         using base_type::begin;
0162         using base_type::end;
0163         using base_type::cbegin;
0164         using base_type::cend;
0165         using base_type::bucket_count;
0166         using base_type::max_bucket_count;
0167         using base_type::bucket_size;
0168         using base_type::bucket;
0169         using base_type::load_factor;
0170         using base_type::max_load_factor;
0171         using base_type::rehash;
0172         using base_type::key_eq;
0173         using base_type::hash_function;
0174 
0175     public:
0176         ptr_unordered_multiset()
0177         { }
0178 
0179         explicit ptr_unordered_multiset( size_type n )
0180          : base_type( n, ptr_container_detail::unordered_associative_container_tag() )
0181         { }
0182 
0183         ptr_unordered_multiset( size_type n,
0184                                 const Hash& comp,
0185                                 const Pred& pred   = Pred(),
0186                                 const Allocator& a = Allocator() )
0187          : base_type( n, comp, pred, a )
0188         { }
0189 
0190         template< typename InputIterator >
0191         ptr_unordered_multiset( InputIterator first, InputIterator last )
0192          : base_type( first, last )
0193         { }
0194 
0195         template< typename InputIterator >
0196         ptr_unordered_multiset( InputIterator first, InputIterator last,
0197                                 const Hash& comp,
0198                                 const Pred& pred   = Pred(),
0199                                 const Allocator& a = Allocator() )
0200          : base_type( first, last, comp, pred, a )
0201         { }
0202 
0203         BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multiset,
0204                                                       base_type,
0205                                                       this_type )
0206 
0207         BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_multiset,
0208                                                       base_type )
0209 
0210     };
0211 
0212     /////////////////////////////////////////////////////////////////////////
0213     // clonability
0214 
0215     template< typename K, typename H, typename P, typename CA, typename A >
0216     inline ptr_unordered_set<K,H,P,CA,A>*
0217     new_clone( const ptr_unordered_set<K,H,P,CA,A>& r )
0218     {
0219         return r.clone().release();
0220     }
0221 
0222     template< typename K, typename H, typename P, typename CA, typename A >
0223     inline ptr_unordered_multiset<K,H,P,CA,A>*
0224     new_clone( const ptr_unordered_multiset<K,H,P,CA,A>& r )
0225     {
0226         return r.clone().release();
0227     }
0228 
0229     /////////////////////////////////////////////////////////////////////////
0230     // swap
0231 
0232     template< typename K, typename H, typename P, typename CA, typename A >
0233     inline void swap( ptr_unordered_set<K,H,P,CA,A>& l,
0234                       ptr_unordered_set<K,H,P,CA,A>& r )
0235     {
0236         l.swap(r);
0237     }
0238 
0239     template< typename K, typename H, typename P, typename CA, typename A >
0240     inline void swap( ptr_unordered_multiset<K,H,P,CA,A>& l,
0241                       ptr_unordered_multiset<K,H,P,CA,A>& r )
0242     {
0243         l.swap(r);
0244     }
0245 
0246 }
0247 
0248 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0249 #pragma GCC diagnostic pop
0250 #endif
0251 
0252 #endif