epoc32/include/stdapis/boost/ptr_container/detail/map_iterator.hpp
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 //
     2 // Boost.Pointer Container
     3 //
     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)
     8 //
     9 // For more information, see http://www.boost.org/libs/ptr_container/
    10 //
    11 
    12 #ifndef BOOST_PTR_CONTAINER_MAP_ITERATOR_HPP
    13 #define BOOST_PTR_CONTAINER_MAP_ITERATOR_HPP
    14 
    15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
    16 # pragma once
    17 #endif
    18 
    19 #include <boost/config.hpp>
    20 #include <boost/iterator/iterator_adaptor.hpp>
    21 #include <utility>
    22 
    23 namespace boost
    24 { 
    25     namespace ptr_container_detail
    26     {
    27         template< class F, class S >
    28         struct ref_pair
    29         {
    30             typedef F first_type;
    31             typedef S second_type;
    32 
    33             const F& first;
    34             S        second;
    35 
    36             template< class F2, class S2 >
    37             ref_pair( const std::pair<F2,S2>& p )
    38             : first(p.first), second(static_cast<S>(p.second))
    39             { }
    40 
    41             template< class RP >
    42             ref_pair( const RP* rp )
    43             : first(rp->first), second(rp->second)
    44             { }
    45             
    46             const ref_pair* const operator->() const
    47             {
    48                 return this;
    49             }
    50         };
    51     }
    52     
    53     template< 
    54               class I, // base iterator 
    55               class F, // first type, key type
    56               class S  // second type, mapped type
    57             > 
    58     class ptr_map_iterator : 
    59         public boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I, 
    60                                         ptr_container_detail::ref_pair<F,S>, 
    61                                         use_default, 
    62                                         ptr_container_detail::ref_pair<F,S> >
    63     {
    64         typedef boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I, 
    65                                          ptr_container_detail::ref_pair<F,S>,
    66                                          use_default, 
    67                                          ptr_container_detail::ref_pair<F,S> > 
    68             base_type;
    69 
    70 
    71     public:
    72         ptr_map_iterator() : base_type()                                 
    73         { }
    74         
    75         explicit ptr_map_iterator( const I& i ) : base_type(i)
    76         { }
    77 
    78         template< class I2, class F2, class S2 >
    79             ptr_map_iterator( const ptr_map_iterator<I2,F2,S2>& r ) 
    80          : base_type(r.base())
    81         { }
    82         
    83    }; // class 'ptr_map_iterator'
    84 
    85 }
    86 
    87 #endif