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_VECTOR_HPP
0013 #define BOOST_PTR_CONTAINER_PTR_VECTOR_HPP
0014 
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018 
0019 #include <vector>
0020 #include <boost/ptr_container/ptr_sequence_adapter.hpp>
0021 #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
0022 #include <boost/type_traits/is_same.hpp>
0023 #include <boost/mpl/if.hpp>
0024 
0025 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0026 #pragma GCC diagnostic push
0027 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0028 #endif
0029 
0030 namespace boost
0031 {
0032 
0033     template
0034     <
0035         class T,
0036         class CloneAllocator = heap_clone_allocator,
0037         class Allocator      = void
0038     >
0039     class ptr_vector : public
0040         ptr_sequence_adapter< T,
0041             std::vector<
0042                 typename ptr_container_detail::void_ptr<T>::type,
0043                 typename boost::mpl::if_<boost::is_same<Allocator, void>,
0044                     std::allocator<typename ptr_container_detail::void_ptr<T>::type>, Allocator>::type
0045             >,
0046             CloneAllocator >
0047     {
0048         typedef
0049 
0050             ptr_sequence_adapter< T,
0051                 std::vector<
0052                     typename ptr_container_detail::void_ptr<T>::type,
0053                     typename boost::mpl::if_<boost::is_same<Allocator, void>,
0054                         std::allocator<typename ptr_container_detail::void_ptr<T>::type>, Allocator>::type
0055                 >,
0056                 CloneAllocator >
0057 
0058             base_class;
0059 
0060         typedef ptr_vector<T,CloneAllocator,Allocator> this_type;
0061 
0062     public:
0063 
0064         BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_vector,
0065                                                       base_class,
0066                                                       this_type )
0067 
0068         explicit ptr_vector( size_type n,
0069                              const allocator_type& alloc = allocator_type() )
0070           : base_class(alloc)
0071         {
0072             this->base().reserve( n );
0073         }
0074     };
0075 
0076     //////////////////////////////////////////////////////////////////////////////
0077     // clonability
0078 
0079     template< typename T, typename CA, typename A >
0080     inline ptr_vector<T,CA,A>* new_clone( const ptr_vector<T,CA,A>& r )
0081     {
0082         return r.clone().release();
0083     }
0084 
0085     /////////////////////////////////////////////////////////////////////////
0086     // swap
0087 
0088     template< typename T, typename CA, typename A >
0089     inline void swap( ptr_vector<T,CA,A>& l, ptr_vector<T,CA,A>& r )
0090     {
0091         l.swap(r);
0092     }
0093 
0094 }
0095 
0096 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
0097 #pragma GCC diagnostic pop
0098 #endif
0099 
0100 #endif