epoc32/include/stdapis/boost/ptr_container/ptr_map.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_map.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,131 @@
     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_MAP_HPP
    1.16 +#define BOOST_PTR_CONTAINER_PTR_MAP_HPP
    1.17 +
    1.18 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
    1.19 +# pragma once
    1.20 +#endif
    1.21 +
    1.22 +#include <map>
    1.23 +#include <boost/ptr_container/ptr_map_adapter.hpp>
    1.24 +
    1.25 +namespace boost
    1.26 +{
    1.27 +    
    1.28 +    template
    1.29 +    < 
    1.30 +        class Key, 
    1.31 +        class T, 
    1.32 +        class Compare        = std::less<Key>,
    1.33 +        class CloneAllocator = heap_clone_allocator,
    1.34 +        class Allocator      = std::allocator< std::pair<const Key,void*> >
    1.35 +    >
    1.36 +    class ptr_map : 
    1.37 +        public ptr_map_adapter<T,std::map<Key,void*,
    1.38 +                               Compare,Allocator>,CloneAllocator>
    1.39 +    {
    1.40 +        typedef ptr_map_adapter<T,std::map<Key,void*,
    1.41 +                                Compare,Allocator>,CloneAllocator>
    1.42 +            base_type;
    1.43 +
    1.44 +        typedef ptr_map<Key,T,Compare,CloneAllocator,Allocator> this_type;
    1.45 +        
    1.46 +    public:
    1.47 +        explicit ptr_map( const Compare& comp = Compare(),
    1.48 +                          const Allocator& a  = Allocator() ) 
    1.49 +          : base_type( comp, a ) { }
    1.50 +
    1.51 +        template< class InputIterator >
    1.52 +        ptr_map( InputIterator first, InputIterator last, 
    1.53 +                 const Compare& comp = Compare(),
    1.54 +                 const Allocator& a  = Allocator() )
    1.55 +          : base_type( first, last, comp, a ) 
    1.56 +        { }
    1.57 +
    1.58 +        BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_map, base_type, 
    1.59 +                                                      this_type );
    1.60 +
    1.61 +    };
    1.62 +    
    1.63 +
    1.64 +
    1.65 +    template
    1.66 +    < 
    1.67 +        class Key, 
    1.68 +        class T, 
    1.69 +        class Compare        = std::less<Key>, 
    1.70 +        class CloneAllocator = heap_clone_allocator,
    1.71 +        class Allocator      = std::allocator< std::pair<const Key,void*> >
    1.72 +    >
    1.73 +    class ptr_multimap : 
    1.74 +        public ptr_multimap_adapter<T,std::multimap<Key,void*,
    1.75 +                                    Compare,Allocator>,CloneAllocator>
    1.76 +    {
    1.77 +        typedef ptr_multimap_adapter<T,std::multimap<Key,void*,
    1.78 +                                     Compare,Allocator>,CloneAllocator>
    1.79 +             base_type;
    1.80 +
    1.81 +        typedef ptr_multimap<Key,T,Compare,CloneAllocator,Allocator> this_type;
    1.82 +        
    1.83 +    public:
    1.84 +        explicit ptr_multimap( const Compare& comp = Compare(),
    1.85 +                               const Allocator& a  = Allocator() ) 
    1.86 +          : base_type( comp, a ) { }
    1.87 +        
    1.88 +        template< class InputIterator >
    1.89 +        ptr_multimap( InputIterator first, InputIterator last,
    1.90 +                      const Compare& comp = Compare(),
    1.91 +                      const Allocator& a  = Allocator() )
    1.92 +          : base_type( first, last, comp, a ) 
    1.93 +        { }
    1.94 +
    1.95 +        BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multimap, 
    1.96 +                                                      base_type,
    1.97 +                                                      this_type );
    1.98 +
    1.99 +    };
   1.100 +
   1.101 +    //////////////////////////////////////////////////////////////////////////////
   1.102 +    // clonability
   1.103 +
   1.104 +    template< class K, class T, class C, class CA, class A >
   1.105 +    inline ptr_map<K,T,C,CA,A>* new_clone( const ptr_map<K,T,C,CA,A>& r )
   1.106 +    {
   1.107 +        return r.clone().release();
   1.108 +    }
   1.109 +
   1.110 +    template< class K, class T, class C, class CA, class A >
   1.111 +    inline ptr_multimap<K,T,C,CA,A>* new_clone( const ptr_multimap<K,T,C,CA,A>& r )
   1.112 +    {
   1.113 +        return r.clone().release();
   1.114 +    }
   1.115 +
   1.116 +    /////////////////////////////////////////////////////////////////////////
   1.117 +    // swap
   1.118 +
   1.119 +    template< typename K, typename T, typename C, typename CA, typename A >
   1.120 +    inline void swap( ptr_map<K,T,C,CA,A>& l, ptr_map<K,T,C,CA,A>& r )
   1.121 +    {
   1.122 +        l.swap(r);
   1.123 +    }
   1.124 +
   1.125 +    template< typename K, typename T, typename C, typename CA, typename A >
   1.126 +    inline void swap( ptr_multimap<K,T,C,CA,A>& l, ptr_multimap<K,T,C,CA,A>& r )
   1.127 +    {
   1.128 +        l.swap(r);
   1.129 +    }
   1.130 +
   1.131 +
   1.132 +}
   1.133 +
   1.134 +#endif