epoc32/include/stdapis/boost/ptr_container/ptr_vector.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/ptr_container/ptr_vector.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,92 @@
     1.4 +//
     1.5 +// Boost.Pointer Container
     1.6 +//
     1.7 +//  Copyright Thorsten Ottosen 2003-2005. Use, modification and
     1.8 +//  distribution is subject to the Boost Software License, Version
     1.9 +//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.10 +//  http://www.boost.org/LICENSE_1_0.txt)
    1.11 +//
    1.12 +// For more information, see http://www.boost.org/libs/ptr_container/
    1.13 +//
    1.14 +
    1.15 +#ifndef BOOST_PTR_CONTAINER_PTR_VECTOR_HPP
    1.16 +#define BOOST_PTR_CONTAINER_PTR_VECTOR_HPP
    1.17 +
    1.18 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
    1.19 +# pragma once
    1.20 +#endif
    1.21 +
    1.22 +#include <vector>
    1.23 +#include <boost/ptr_container/ptr_sequence_adapter.hpp>
    1.24 +
    1.25 +namespace boost
    1.26 +{
    1.27 +
    1.28 +    template
    1.29 +    < 
    1.30 +        class T, 
    1.31 +        class CloneAllocator = heap_clone_allocator,
    1.32 +        class Allocator      = std::allocator<void*>
    1.33 +    >
    1.34 +    class ptr_vector : public 
    1.35 +        ptr_sequence_adapter< T, 
    1.36 +                              std::vector<void*,Allocator>, 
    1.37 +                              CloneAllocator >
    1.38 +    {  
    1.39 +        typedef ptr_sequence_adapter< T, 
    1.40 +                                      std::vector<void*,Allocator>, 
    1.41 +                                      CloneAllocator > 
    1.42 +            base_class;
    1.43 +
    1.44 +        typedef ptr_vector<T,CloneAllocator,Allocator> this_type;
    1.45 +        
    1.46 +    public:
    1.47 +
    1.48 +        BOOST_PTR_CONTAINER_DEFINE_NON_INHERITED_MEMBERS( ptr_vector, 
    1.49 +                                                          base_class,
    1.50 +                                                          this_type );
    1.51 +
    1.52 +        ptr_vector( size_type n,
    1.53 +                    const allocator_type& alloc = allocator_type() )
    1.54 +          : base_class(alloc)
    1.55 +        {
    1.56 +            this->c_private().reserve( n );
    1.57 +        }
    1.58 +
    1.59 +    public: // serialization
    1.60 +
    1.61 +        template< class Archive >
    1.62 +        void load( Archive& ar, unsigned )
    1.63 +        {
    1.64 +            size_type n;
    1.65 +            ar & n;
    1.66 +            
    1.67 +            this->reserve( n );
    1.68 +            this->load_helper( ar, n );
    1.69 +        }
    1.70 +  
    1.71 +        BOOST_SERIALIZATION_SPLIT_MEMBER()
    1.72 +        
    1.73 +    };
    1.74 +
    1.75 +    //////////////////////////////////////////////////////////////////////////////
    1.76 +    // clonability
    1.77 +
    1.78 +    template< typename T, typename CA, typename A >
    1.79 +    inline ptr_vector<T,CA,A>* new_clone( const ptr_vector<T,CA,A>& r )
    1.80 +    {
    1.81 +        return r.clone().release();
    1.82 +    }
    1.83 +
    1.84 +    /////////////////////////////////////////////////////////////////////////
    1.85 +    // swap
    1.86 +
    1.87 +    template< typename T, typename CA, typename A >
    1.88 +    inline void swap( ptr_vector<T,CA,A>& l, ptr_vector<T,CA,A>& r )
    1.89 +    {
    1.90 +        l.swap(r);
    1.91 +    }
    1.92 +    
    1.93 +}
    1.94 +
    1.95 +#endif