epoc32/include/stdapis/boost/ptr_container/detail/map_iterator.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/detail/map_iterator.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,87 @@
     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_MAP_ITERATOR_HPP
    1.16 +#define BOOST_PTR_CONTAINER_MAP_ITERATOR_HPP
    1.17 +
    1.18 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
    1.19 +# pragma once
    1.20 +#endif
    1.21 +
    1.22 +#include <boost/config.hpp>
    1.23 +#include <boost/iterator/iterator_adaptor.hpp>
    1.24 +#include <utility>
    1.25 +
    1.26 +namespace boost
    1.27 +{ 
    1.28 +    namespace ptr_container_detail
    1.29 +    {
    1.30 +        template< class F, class S >
    1.31 +        struct ref_pair
    1.32 +        {
    1.33 +            typedef F first_type;
    1.34 +            typedef S second_type;
    1.35 +
    1.36 +            const F& first;
    1.37 +            S        second;
    1.38 +
    1.39 +            template< class F2, class S2 >
    1.40 +            ref_pair( const std::pair<F2,S2>& p )
    1.41 +            : first(p.first), second(static_cast<S>(p.second))
    1.42 +            { }
    1.43 +
    1.44 +            template< class RP >
    1.45 +            ref_pair( const RP* rp )
    1.46 +            : first(rp->first), second(rp->second)
    1.47 +            { }
    1.48 +            
    1.49 +            const ref_pair* const operator->() const
    1.50 +            {
    1.51 +                return this;
    1.52 +            }
    1.53 +        };
    1.54 +    }
    1.55 +    
    1.56 +    template< 
    1.57 +              class I, // base iterator 
    1.58 +              class F, // first type, key type
    1.59 +              class S  // second type, mapped type
    1.60 +            > 
    1.61 +    class ptr_map_iterator : 
    1.62 +        public boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I, 
    1.63 +                                        ptr_container_detail::ref_pair<F,S>, 
    1.64 +                                        use_default, 
    1.65 +                                        ptr_container_detail::ref_pair<F,S> >
    1.66 +    {
    1.67 +        typedef boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I, 
    1.68 +                                         ptr_container_detail::ref_pair<F,S>,
    1.69 +                                         use_default, 
    1.70 +                                         ptr_container_detail::ref_pair<F,S> > 
    1.71 +            base_type;
    1.72 +
    1.73 +
    1.74 +    public:
    1.75 +        ptr_map_iterator() : base_type()                                 
    1.76 +        { }
    1.77 +        
    1.78 +        explicit ptr_map_iterator( const I& i ) : base_type(i)
    1.79 +        { }
    1.80 +
    1.81 +        template< class I2, class F2, class S2 >
    1.82 +            ptr_map_iterator( const ptr_map_iterator<I2,F2,S2>& r ) 
    1.83 +         : base_type(r.base())
    1.84 +        { }
    1.85 +        
    1.86 +   }; // class 'ptr_map_iterator'
    1.87 +
    1.88 +}
    1.89 +
    1.90 +#endif