sl@0: sl@0: #ifndef BOOST_MPL_PAIR_VIEW_HPP_INCLUDED sl@0: #define BOOST_MPL_PAIR_VIEW_HPP_INCLUDED sl@0: sl@0: // Copyright David Abrahams 2003-2004 sl@0: // Copyright Aleksey Gurtovoy 2004 sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. sl@0: // (See accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: // sl@0: // See http://www.boost.org/libs/mpl for documentation. sl@0: sl@0: // $Source: /cvsroot/boost/boost/boost/mpl/pair_view.hpp,v $ sl@0: // $Date: 2004/11/28 01:56:21 $ sl@0: // $Revision: 1.5 $ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: namespace boost { namespace mpl { sl@0: sl@0: namespace aux { sl@0: struct pair_iter_tag; sl@0: sl@0: #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: template< typename Iter1, typename Iter2, typename Category > sl@0: struct pair_iter; sl@0: sl@0: template< typename Category > struct prior_pair_iter sl@0: { sl@0: template< typename Iter1, typename Iter2 > struct apply sl@0: { sl@0: typedef typename mpl::prior::type i1_; sl@0: typedef typename mpl::prior::type i2_; sl@0: typedef pair_iter type; sl@0: }; sl@0: }; sl@0: sl@0: template<> struct prior_pair_iter sl@0: { sl@0: template< typename Iter1, typename Iter2 > struct apply sl@0: { sl@0: typedef pair_iter type; sl@0: }; sl@0: }; sl@0: sl@0: #endif sl@0: } sl@0: sl@0: template< sl@0: typename Iter1 sl@0: , typename Iter2 sl@0: , typename Category sl@0: > sl@0: struct pair_iter sl@0: { sl@0: typedef aux::pair_iter_tag tag; sl@0: typedef Category category; sl@0: typedef Iter1 first; sl@0: typedef Iter2 second; sl@0: sl@0: #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: typedef pair< sl@0: typename deref::type sl@0: , typename deref::type sl@0: > type; sl@0: sl@0: typedef typename mpl::next::type i1_; sl@0: typedef typename mpl::next::type i2_; sl@0: typedef pair_iter next; sl@0: sl@0: typedef apply_wrap2< aux::prior_pair_iter,Iter1,Iter2 >::type prior; sl@0: #endif sl@0: }; sl@0: sl@0: sl@0: #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: template< typename Iter1, typename Iter2, typename C > sl@0: struct deref< pair_iter > sl@0: { sl@0: typedef pair< sl@0: typename deref::type sl@0: , typename deref::type sl@0: > type; sl@0: }; sl@0: sl@0: template< typename Iter1, typename Iter2, typename C > sl@0: struct next< pair_iter > sl@0: { sl@0: typedef typename mpl::next::type i1_; sl@0: typedef typename mpl::next::type i2_; sl@0: typedef pair_iter type; sl@0: }; sl@0: sl@0: template< typename Iter1, typename Iter2, typename C > sl@0: struct prior< pair_iter > sl@0: { sl@0: typedef typename mpl::prior::type i1_; sl@0: typedef typename mpl::prior::type i2_; sl@0: typedef pair_iter type; sl@0: }; sl@0: sl@0: #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION sl@0: sl@0: sl@0: template<> struct advance_impl sl@0: { sl@0: template< typename Iter, typename D > struct apply sl@0: { sl@0: typedef typename mpl::advance< typename Iter::first,D >::type i1_; sl@0: typedef typename mpl::advance< typename Iter::second,D >::type i2_; sl@0: typedef pair_iter type; sl@0: }; sl@0: }; sl@0: sl@0: template<> struct distance_impl sl@0: { sl@0: template< typename Iter1, typename Iter2 > struct apply sl@0: { sl@0: // agurt, 10/nov/04: MSVC 6.5 ICE-s on forwarding sl@0: typedef typename mpl::distance< sl@0: typename first::type sl@0: , typename first::type sl@0: >::type type; sl@0: }; sl@0: }; sl@0: sl@0: sl@0: template< sl@0: typename BOOST_MPL_AUX_NA_PARAM(Sequence1) sl@0: , typename BOOST_MPL_AUX_NA_PARAM(Sequence2) sl@0: > sl@0: struct pair_view sl@0: { sl@0: typedef nested_begin_end_tag tag; sl@0: sl@0: typedef typename begin::type iter1_; sl@0: typedef typename begin::type iter2_; sl@0: typedef typename min< sl@0: typename iterator_category::type sl@0: , typename iterator_category::type sl@0: >::type category_; sl@0: sl@0: typedef pair_iter begin; sl@0: sl@0: typedef pair_iter< sl@0: typename end::type sl@0: , typename end::type sl@0: , category_ sl@0: > end; sl@0: }; sl@0: sl@0: BOOST_MPL_AUX_NA_SPEC(2, pair_view) sl@0: sl@0: }} sl@0: sl@0: #endif // BOOST_MPL_PAIR_VIEW_HPP_INCLUDED