2 // Boost.Pointer Container
4 // Copyright Thorsten Ottosen 2003-2005. Use, modification and
5 // distribution is subject to the Boost Software License, Version
6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org/libs/ptr_container/
12 #ifndef BOOST_PTR_CONTAINER_PTR_VECTOR_HPP
13 #define BOOST_PTR_CONTAINER_PTR_VECTOR_HPP
15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
20 #include <boost/ptr_container/ptr_sequence_adapter.hpp>
28 class CloneAllocator = heap_clone_allocator,
29 class Allocator = std::allocator<void*>
31 class ptr_vector : public
32 ptr_sequence_adapter< T,
33 std::vector<void*,Allocator>,
36 typedef ptr_sequence_adapter< T,
37 std::vector<void*,Allocator>,
41 typedef ptr_vector<T,CloneAllocator,Allocator> this_type;
45 BOOST_PTR_CONTAINER_DEFINE_NON_INHERITED_MEMBERS( ptr_vector,
49 ptr_vector( size_type n,
50 const allocator_type& alloc = allocator_type() )
53 this->c_private().reserve( n );
56 public: // serialization
58 template< class Archive >
59 void load( Archive& ar, unsigned )
65 this->load_helper( ar, n );
68 BOOST_SERIALIZATION_SPLIT_MEMBER()
72 //////////////////////////////////////////////////////////////////////////////
75 template< typename T, typename CA, typename A >
76 inline ptr_vector<T,CA,A>* new_clone( const ptr_vector<T,CA,A>& r )
78 return r.clone().release();
81 /////////////////////////////////////////////////////////////////////////
84 template< typename T, typename CA, typename A >
85 inline void swap( ptr_vector<T,CA,A>& l, ptr_vector<T,CA,A>& r )