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 2003-2005. 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_SET_HPP
0013 #define BOOST_PTR_CONTAINER_PTR_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 <set>
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 Compare        = std::less<Key>,
0036         class CloneAllocator = heap_clone_allocator,
0037         class Allocator      = std::allocator<typename ptr_container_detail::void_ptr<Key>::type>
0038     >
0039     class ptr_set :
0040         public ptr_set_adapter< Key, std::set<
0041             typename ptr_container_detail::void_ptr<Key>::type,
0042             void_ptr_indirect_fun<Compare,Key>,Allocator>,
0043                                 CloneAllocator, true >
0044     {
0045         typedef ptr_set_adapter< Key, std::set<
0046             typename ptr_container_detail::void_ptr<Key>::type,
0047             void_ptr_indirect_fun<Compare,Key>,Allocator>,
0048                                  CloneAllocator, true >
0049              base_type;
0050 
0051         typedef ptr_set<Key,Compare,CloneAllocator,Allocator> this_type;
0052 
0053     public:
0054         ptr_set()
0055         { }
0056 
0057         explicit ptr_set( const Compare& comp,
0058                           const Allocator& a = Allocator() )
0059          : base_type( comp, a )
0060         { }
0061 
0062         template< typename InputIterator >
0063         ptr_set( InputIterator first, InputIterator last )
0064          : base_type( first, last )
0065         { }
0066 
0067         template< typename InputIterator >
0068         ptr_set( InputIterator first, InputIterator last,
0069                  const Compare& comp,
0070                  const Allocator& a = Allocator() )
0071          : base_type( first, last, comp, a )
0072         { }
0073 
0074         BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set,
0075                                                       base_type,
0076                                                       this_type )
0077 
0078         BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_set, base_type )
0079 
0080     };
0081 
0082 
0083 
0084     template
0085     <
0086         class Key,
0087         class Compare        = std::less<Key>,
0088         class CloneAllocator = heap_clone_allocator,
0089         class Allocator      = std::allocator<void*>
0090     >
0091     class ptr_multiset :
0092         public ptr_multiset_adapter< Key,
0093                                      std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
0094                                      CloneAllocator, true >
0095     {
0096         typedef ptr_multiset_adapter< Key,
0097                                       std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
0098                                       CloneAllocator, true >
0099               base_type;
0100         typedef ptr_multiset<Key,Compare,CloneAllocator,Allocator> this_type;
0101 
0102     public:
0103         ptr_multiset()
0104         { }
0105 
0106         explicit ptr_multiset( const Compare& comp,
0107                                const Allocator& a    = Allocator() )
0108          : base_type( comp, a )
0109         { }
0110 
0111         template< typename InputIterator >
0112         ptr_multiset( InputIterator first, InputIterator last )
0113          : base_type( first, last )
0114         { }
0115 
0116         template< typename InputIterator >
0117         ptr_multiset( InputIterator first, InputIterator last,
0118                       const Compare& comp,
0119                       const Allocator& a  = Allocator() )
0120          : base_type( first, last, comp, a )
0121         { }
0122 
0123         BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset,
0124                                                       base_type,
0125                                                       this_type )
0126 
0127         BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_multiset,
0128                                                       base_type )
0129 
0130     };
0131 
0132     /////////////////////////////////////////////////////////////////////////
0133     // clonability
0134 
0135     template< typename K, typename C, typename CA, typename A >
0136     inline ptr_set<K,C,CA,A>* new_clone( const ptr_set<K,C,CA,A>& r )
0137     {
0138         return r.clone().release();
0139     }
0140 
0141     template< typename K, typename C, typename CA, typename A >
0142     inline ptr_multiset<K,C,CA,A>* new_clone( const ptr_multiset<K,C,CA,A>& r )
0143     {
0144         return r.clone().release();
0145     }
0146 
0147     /////////////////////////////////////////////////////////////////////////
0148     // swap
0149 
0150     template< typename K, typename C, typename CA, typename A >
0151     inline void swap( ptr_set<K,C,CA,A>& l, ptr_set<K,C,CA,A>& r )
0152     {
0153         l.swap(r);
0154     }
0155 
0156     template< typename K, typename C, typename CA, typename A >
0157     inline void swap( ptr_multiset<K,C,CA,A>& l, ptr_multiset<K,C,CA,A>& r )
0158     {
0159         l.swap(r);
0160     }
0161 
0162 }
0163 
0164 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0165 #pragma GCC diagnostic pop
0166 #endif
0167 
0168 #endif