#ifndef BOOST_MPL_PAIR_VIEW_HPP_INCLUDED #define BOOST_MPL_PAIR_VIEW_HPP_INCLUDED // Copyright David Abrahams 2003-2004 // Copyright Aleksey Gurtovoy 2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Source$ // $Date$ // $Revision$ #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace mpl { #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template< typename I1, typename I2, typename Category > struct pair_iter; template< typename Category > struct pair_iter_ops { template< typename I1, typename I2 > struct result_ { typedef typename mpl::next::type i1_; typedef typename mpl::next::type i2_; typedef pair_iter next; typedef pair< typename deref::type, typename deref::type > type; }; }; template<> struct pair_iter_ops { template< typename I1, typename I2 > struct result_ { typedef bidirectional_iterator_tag category; typedef typename mpl::next::type i1_; typedef typename mpl::next::type i2_; typedef pair_iter next; typedef typename mpl::prior::type k1_; typedef typename mpl::prior::type k2_; typedef pair_iter prior; }; }; template<> struct pair_iter_ops { template< typename I1, typename I2 > struct result_ { typedef random_access_iterator_tag category; typedef typename mpl::next::type i1_; typedef typename mpl::next::type i2_; typedef pair_iter next; typedef typename mpl::prior::type k1_; typedef typename mpl::prior::type k2_; typedef pair_iter prior; template< typename Distance > struct BOOST_MPL_AUX_ITERATOR_ADVANCE { typedef typename advance::type iter1_; typedef typename advance::type iter2_; typedef pair_iter type; }; template< typename U > struct BOOST_MPL_AUX_ITERATOR_DISTANCE : distance { }; }; }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template< typename I1, typename I2, typename Category > struct pair_iter #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) : aux::msvc_eti_base< pair_iter_ops ::template result_ >::type #endif { typedef Category category; }; #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template< typename I1, typename I2, typename C > struct deref< pair_iter > { typedef pair< typename deref::type, typename deref::type > type; }; template< typename I1, typename I2, typename C > struct next< pair_iter > { typedef typename mpl::next::type i1_; typedef typename mpl::next::type i2_; typedef pair_iter type; }; template< typename I1, typename I2, typename C > struct prior< pair_iter > { typedef typename mpl::prior::type i1_; typedef typename mpl::prior::type i2_; typedef pair_iter type; }; template< typename I1, typename I2, typename C, typename Distance > struct advance< pair_iter,Distance> { typedef typename mpl::advance::type iter1_; typedef typename mpl::advance::type iter2_; typedef pair_iter type; }; template< typename I1, typename I2, typename K1, typename K2, typename C > struct distance< pair_iter, pair_iter > : mpl::distance { }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template< typename BOOST_MPL_AUX_NA_PARAM(Sequence1) , typename BOOST_MPL_AUX_NA_PARAM(Sequence2) > struct pair_view { typedef nested_begin_end_tag tag; typedef typename begin::type iter1_; typedef typename begin::type iter2_; typedef typename min< typename iterator_category::type , typename iterator_category::type >::type category_; typedef pair_iter begin; typedef pair_iter< typename end::type , typename end::type , category_ > end; }; BOOST_MPL_AUX_NA_SPEC(2, pair_view) }} #endif // BOOST_MPL_PAIR_VIEW_HPP_INCLUDED