// // Boost.Pointer Container // // Copyright Thorsten Ottosen 2003-2005. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // For more information, see http://www.boost.org/libs/ptr_container/ // #ifndef BOOST_PTR_CONTAINER_PTR_SET_HPP #define BOOST_PTR_CONTAINER_PTR_SET_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #include #include #include namespace boost { template < class Key, class Compare = std::less, class CloneAllocator = heap_clone_allocator, class Allocator = std::allocator > class ptr_set : public ptr_set_adapter< Key, std::set,Allocator>, CloneAllocator > { typedef ptr_set_adapter< Key, std::set,Allocator>, CloneAllocator > base_type; typedef ptr_set this_type; public: explicit ptr_set( const Compare& comp = Compare(), const Allocator& a = Allocator() ) : base_type( comp, a ) { } template< typename InputIterator > ptr_set( InputIterator first, InputIterator last, const Compare& comp = Compare(), const Allocator& a = Allocator() ) : base_type( first, last, comp, a ) { } BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set, base_type, this_type ); BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_set, base_type ) }; template < class Key, class Compare = std::less, class CloneAllocator = heap_clone_allocator, class Allocator = std::allocator > class ptr_multiset : public ptr_multiset_adapter< Key, std::multiset,Allocator>, CloneAllocator > { typedef ptr_multiset_adapter< Key, std::multiset,Allocator>, CloneAllocator > base_type; typedef ptr_multiset this_type; public: explicit ptr_multiset( const Compare& comp = Compare(), const Allocator& a = Allocator() ) : base_type( comp, a ) { } template< typename InputIterator > ptr_multiset( InputIterator first, InputIterator last, const Compare& comp = Compare(), const Allocator& a = Allocator() ) : base_type( first, last, comp, a ) { } BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset, base_type, this_type ); BOOST_PTR_CONTAINER_DEFINE_COPY_CONSTRUCTORS( ptr_multiset, base_type ); }; ///////////////////////////////////////////////////////////////////////// // clonability template< typename K, typename C, typename CA, typename A > inline ptr_set* new_clone( const ptr_set& r ) { return r.clone().release(); } template< typename K, typename C, typename CA, typename A > inline ptr_multiset* new_clone( const ptr_multiset& r ) { return r.clone().release(); } ///////////////////////////////////////////////////////////////////////// // swap template< typename K, typename C, typename CA, typename A > inline void swap( ptr_set& l, ptr_set& r ) { l.swap(r); } template< typename K, typename C, typename CA, typename A > inline void swap( ptr_multiset& l, ptr_multiset& r ) { l.swap(r); } } #endif