Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:34

0001 //
0002 // Boost.Pointer Container
0003 //
0004 //  Copyright Thorsten Ottosen 2003-2005. Use, modification and
0005 //  distribution is subject to the Boost Software License, Version
0006 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 //  http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // For more information, see http://www.boost.org/libs/ptr_container/
0010 //
0011 
0012 #ifndef BOOST_PTR_CONTAINER_MAP_ITERATOR_HPP
0013 #define BOOST_PTR_CONTAINER_MAP_ITERATOR_HPP
0014 
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018 
0019 #include <boost/config.hpp>
0020 #include <boost/iterator/iterator_adaptor.hpp>
0021 #include <boost/utility/compare_pointees.hpp>
0022 #include <utility>
0023 
0024 #if defined(BOOST_MSVC)
0025 # pragma warning(push)
0026 # pragma warning(disable:4512)    // Assignment operator could not be generated.
0027 #endif
0028 
0029 namespace boost
0030 {
0031     namespace ptr_container_detail
0032     {
0033         template< class F, class S >
0034         struct ref_pair
0035         {
0036             typedef F first_type;
0037             typedef S second_type;
0038 
0039             const F& first;
0040             S        second;
0041 
0042             template< class F2, class S2 >
0043             ref_pair( const std::pair<F2,S2>& p )
0044             : first(p.first), second(static_cast<S>(p.second))
0045             { }
0046 
0047             template< class RP >
0048             ref_pair( const RP* rp )
0049             : first(rp->first), second(rp->second)
0050             { }
0051 
0052             const ref_pair* operator->() const
0053             {
0054                 return this;
0055             }
0056 
0057             friend inline bool operator==( ref_pair l, ref_pair r )
0058             {
0059                 return l.first == r.first &&
0060                        boost::equal_pointees( l.second, r.second );
0061             }
0062 
0063             friend inline bool operator!=( ref_pair l, ref_pair r )
0064             {
0065                 return !( l == r );
0066             }
0067 
0068             friend inline bool operator<( ref_pair l, ref_pair r )
0069             {
0070                 if( l.first == r.first )
0071                     return boost::less_pointees( l.second, r.second );
0072                 else
0073                     return l.first < r.first;
0074             }
0075 
0076             friend inline bool operator>( ref_pair l, ref_pair r )
0077             {
0078                 return r < l;
0079             }
0080 
0081             friend inline bool operator<=( ref_pair l, ref_pair r )
0082             {
0083                 return !(r < l);
0084             }
0085 
0086             friend inline bool operator>=( ref_pair l, ref_pair r )
0087             {
0088                 return !(l < r);
0089             }
0090 
0091         };
0092     }
0093 
0094     template<
0095               class I, // base iterator
0096               class F, // first type, key type
0097               class S  // second type, mapped type
0098             >
0099     class ptr_map_iterator :
0100         public boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I,
0101                                         ptr_container_detail::ref_pair<F,S>,
0102                                         use_default,
0103                                         ptr_container_detail::ref_pair<F,S> >
0104     {
0105         typedef boost::iterator_adaptor< ptr_map_iterator<I,F,S>, I,
0106                                          ptr_container_detail::ref_pair<F,S>,
0107                                          use_default,
0108                                          ptr_container_detail::ref_pair<F,S> >
0109             base_type;
0110 
0111 
0112     public:
0113         ptr_map_iterator() : base_type()
0114         { }
0115 
0116         explicit ptr_map_iterator( const I& i ) : base_type(i)
0117         { }
0118 
0119         template< class I2, class F2, class S2 >
0120             ptr_map_iterator( const ptr_map_iterator<I2,F2,S2>& r )
0121          : base_type(r.base())
0122         { }
0123 
0124    }; // class 'ptr_map_iterator'
0125 
0126 }
0127 
0128 #if defined(BOOST_MSVC)
0129 # pragma warning(pop)
0130 #endif
0131 
0132 #endif