Back to home page

EIC code displayed by LXR

 
 

    


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

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_LIST_HPP
0013 #define BOOST_PTR_CONTAINER_PTR_LIST_HPP
0014 
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018 
0019 #include <boost/ptr_container/ptr_sequence_adapter.hpp>
0020 #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
0021 #include <list>
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 T,
0034         class CloneAllocator = heap_clone_allocator,
0035         class Allocator      = std::allocator<typename ptr_container_detail::void_ptr<T>::type>
0036     >
0037     class ptr_list : public
0038         ptr_sequence_adapter< T, std::list<
0039             typename ptr_container_detail::void_ptr<T>::type,Allocator>,
0040                               CloneAllocator >
0041     {
0042         typedef    ptr_sequence_adapter< T, std::list<
0043             typename ptr_container_detail::void_ptr<T>::type,Allocator>,
0044                                          CloneAllocator >
0045             base_class;
0046 
0047         typedef ptr_list<T,CloneAllocator,Allocator>  this_type;
0048         typedef BOOST_DEDUCED_TYPENAME boost::remove_nullable<T>::type U;
0049 
0050     public:
0051         BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_list,
0052                                                       base_class,
0053                                                       this_type )
0054 
0055         typedef BOOST_DEDUCED_TYPENAME base_class::value_type value_type;
0056 
0057     public:
0058         using base_class::merge;
0059 
0060         void merge( ptr_list& x )
0061         {
0062             merge( x, std::less<U>() );
0063         }
0064 
0065         template< typename Compare >
0066         void merge( ptr_list& x, Compare comp )
0067         {
0068             this->base().merge( x.base(), void_ptr_indirect_fun<Compare,U>( comp ) ); }
0069 
0070         void sort()
0071         {
0072             sort( std::less<U>() );
0073         };
0074 
0075         template< typename Compare >
0076         void sort( Compare comp )
0077         {
0078             this->base().sort( void_ptr_indirect_fun<Compare,U>( comp ) );
0079         }
0080 
0081         template< class Pred >
0082         void erase_if( iterator first, iterator last, Pred pred )
0083         {
0084             base_class::erase_if( first, last, pred );
0085         }
0086 
0087         template< class Pred >
0088         void erase_if( Pred pred )
0089         {
0090             this->base().remove_if( BOOST_DEDUCED_TYPENAME base_class::
0091                     BOOST_NESTED_TEMPLATE void_ptr_delete_if<Pred,value_type>
0092                                     (pred) );
0093         }
0094 
0095     }; // class 'ptr_list'
0096 
0097     //////////////////////////////////////////////////////////////////////////////
0098     // clonability
0099 
0100     template< typename T, typename CA, typename A >
0101     inline ptr_list<T,CA,A>* new_clone( const ptr_list<T,CA,A>& r )
0102     {
0103         return r.clone().release();
0104     }
0105 
0106     /////////////////////////////////////////////////////////////////////////
0107     // swap
0108 
0109     template< typename T, typename CA, typename A >
0110     inline void swap( ptr_list<T,CA,A>& l, ptr_list<T,CA,A>& r )
0111     {
0112         l.swap(r);
0113     }
0114 }
0115 
0116 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0117 #pragma GCC diagnostic pop
0118 #endif
0119 
0120 #endif