Chris@16: // Chris@16: // Boost.Pointer Container Chris@16: // Chris@16: // Copyright Thorsten Ottosen 2008. Use, modification and Chris@16: // distribution is subject to the Boost Software License, Version Chris@16: // 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // For more information, see http://www.boost.org/libs/ptr_container/ Chris@16: // Chris@16: Chris@16: #ifndef BOOST_PTR_CONTAINER_PTR_UNORDERED_SET_HPP Chris@16: #define BOOST_PTR_CONTAINER_PTR_UNORDERED_SET_HPP Chris@16: Chris@16: #if defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost Chris@16: { Chris@16: Chris@16: template Chris@16: < Chris@16: class Key, Chris@16: class Hash = boost::hash, Chris@16: class Pred = std::equal_to, Chris@16: class CloneAllocator = heap_clone_allocator, Chris@16: class Allocator = std::allocator Chris@16: > Chris@16: class ptr_unordered_set : Chris@16: public ptr_set_adapter< Key, Chris@16: boost::unordered_set, Chris@16: void_ptr_indirect_fun,Allocator>, Chris@16: CloneAllocator, false > Chris@16: { Chris@16: typedef ptr_set_adapter< Key, Chris@16: boost::unordered_set, Chris@16: void_ptr_indirect_fun,Allocator>, Chris@16: CloneAllocator, false > Chris@16: base_type; Chris@16: Chris@16: typedef ptr_unordered_set this_type; Chris@16: Chris@16: public: Chris@16: typedef typename base_type::size_type size_type; Chris@16: Chris@16: private: Chris@16: using base_type::lower_bound; Chris@16: using base_type::upper_bound; Chris@16: using base_type::rbegin; Chris@16: using base_type::rend; Chris@16: using base_type::crbegin; Chris@16: using base_type::crend; Chris@16: using base_type::key_comp; Chris@16: using base_type::value_comp; Chris@16: using base_type::front; Chris@16: using base_type::back; Chris@16: Chris@16: public: Chris@16: using base_type::begin; Chris@16: using base_type::end; Chris@16: using base_type::cbegin; Chris@16: using base_type::cend; Chris@16: using base_type::bucket_count; Chris@16: using base_type::max_bucket_count; Chris@16: using base_type::bucket_size; Chris@16: using base_type::bucket; Chris@16: using base_type::load_factor; Chris@16: using base_type::max_load_factor; Chris@16: using base_type::rehash; Chris@16: using base_type::key_eq; Chris@16: using base_type::hash_function; Chris@16: Chris@16: public: Chris@16: ptr_unordered_set() Chris@16: {} Chris@16: Chris@16: explicit ptr_unordered_set( size_type n ) Chris@16: : base_type( n, ptr_container_detail::unordered_associative_container_tag() ) Chris@16: { } Chris@16: Chris@16: ptr_unordered_set( size_type n, Chris@16: const Hash& comp, Chris@16: const Pred& pred = Pred(), Chris@16: const Allocator& a = Allocator() ) Chris@16: : base_type( n, comp, pred, a ) Chris@16: { } Chris@16: Chris@16: template< typename InputIterator > Chris@16: ptr_unordered_set( InputIterator first, InputIterator last ) Chris@16: : base_type( first, last ) Chris@16: { } Chris@16: Chris@16: template< typename InputIterator > Chris@16: ptr_unordered_set( InputIterator first, InputIterator last, Chris@16: const Hash& comp, Chris@16: const Pred& pred = Pred(), Chris@16: const Allocator& a = Allocator() ) Chris@16: : base_type( first, last, comp, pred, a ) Chris@16: { } Chris@16: Chris@16: BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_set, Chris@16: base_type, Chris@16: this_type ) Chris@16: Chris@16: BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_set, Chris@16: base_type ) Chris@16: Chris@16: }; Chris@16: Chris@16: Chris@16: template Chris@16: < Chris@16: class Key, Chris@16: class Hash = boost::hash, Chris@16: class Pred = std::equal_to, Chris@16: class CloneAllocator = heap_clone_allocator, Chris@16: class Allocator = std::allocator Chris@16: > Chris@16: class ptr_unordered_multiset : Chris@16: public ptr_multiset_adapter< Key, Chris@16: boost::unordered_multiset, Chris@16: void_ptr_indirect_fun,Allocator>, Chris@16: CloneAllocator, false > Chris@16: { Chris@16: typedef ptr_multiset_adapter< Key, Chris@16: boost::unordered_multiset, Chris@16: void_ptr_indirect_fun,Allocator>, Chris@16: CloneAllocator, false > Chris@16: base_type; Chris@16: typedef ptr_unordered_multiset this_type; Chris@16: Chris@16: public: Chris@16: typedef typename base_type::size_type size_type; Chris@16: Chris@16: private: Chris@16: using base_type::lower_bound; Chris@16: using base_type::upper_bound; Chris@16: using base_type::rbegin; Chris@16: using base_type::rend; Chris@16: using base_type::crbegin; Chris@16: using base_type::crend; Chris@16: using base_type::key_comp; Chris@16: using base_type::value_comp; Chris@16: using base_type::front; Chris@16: using base_type::back; Chris@16: Chris@16: public: Chris@16: using base_type::begin; Chris@16: using base_type::end; Chris@16: using base_type::cbegin; Chris@16: using base_type::cend; Chris@16: using base_type::bucket_count; Chris@16: using base_type::max_bucket_count; Chris@16: using base_type::bucket_size; Chris@16: using base_type::bucket; Chris@16: using base_type::load_factor; Chris@16: using base_type::max_load_factor; Chris@16: using base_type::rehash; Chris@16: using base_type::key_eq; Chris@16: using base_type::hash_function; Chris@16: Chris@16: public: Chris@16: ptr_unordered_multiset() Chris@16: { } Chris@16: Chris@16: explicit ptr_unordered_multiset( size_type n ) Chris@16: : base_type( n, ptr_container_detail::unordered_associative_container_tag() ) Chris@16: { } Chris@16: Chris@16: ptr_unordered_multiset( size_type n, Chris@16: const Hash& comp, Chris@16: const Pred& pred = Pred(), Chris@16: const Allocator& a = Allocator() ) Chris@16: : base_type( n, comp, pred, a ) Chris@16: { } Chris@16: Chris@16: template< typename InputIterator > Chris@16: ptr_unordered_multiset( InputIterator first, InputIterator last ) Chris@16: : base_type( first, last ) Chris@16: { } Chris@16: Chris@16: template< typename InputIterator > Chris@16: ptr_unordered_multiset( InputIterator first, InputIterator last, Chris@16: const Hash& comp, Chris@16: const Pred& pred = Pred(), Chris@16: const Allocator& a = Allocator() ) Chris@16: : base_type( first, last, comp, pred, a ) Chris@16: { } Chris@16: Chris@16: BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_unordered_multiset, Chris@16: base_type, Chris@16: this_type ) Chris@16: Chris@16: BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_unordered_multiset, Chris@16: base_type ) Chris@16: Chris@16: }; Chris@16: Chris@16: ///////////////////////////////////////////////////////////////////////// Chris@16: // clonability Chris@16: Chris@16: template< typename K, typename H, typename P, typename CA, typename A > Chris@16: inline ptr_unordered_set* Chris@16: new_clone( const ptr_unordered_set& r ) Chris@16: { Chris@16: return r.clone().release(); Chris@16: } Chris@16: Chris@16: template< typename K, typename H, typename P, typename CA, typename A > Chris@16: inline ptr_unordered_multiset* Chris@16: new_clone( const ptr_unordered_multiset& r ) Chris@16: { Chris@16: return r.clone().release(); Chris@16: } Chris@16: Chris@16: ///////////////////////////////////////////////////////////////////////// Chris@16: // swap Chris@16: Chris@16: template< typename K, typename H, typename P, typename CA, typename A > Chris@16: inline void swap( ptr_unordered_set& l, Chris@16: ptr_unordered_set& r ) Chris@16: { Chris@16: l.swap(r); Chris@16: } Chris@16: Chris@16: template< typename K, typename H, typename P, typename CA, typename A > Chris@16: inline void swap( ptr_unordered_multiset& l, Chris@16: ptr_unordered_multiset& r ) Chris@16: { Chris@16: l.swap(r); Chris@16: } Chris@16: Chris@16: } Chris@16: Chris@16: #endif