Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:39

0001 
0002 #ifndef BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED
0003 #define BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/apply.hpp>
0018 #include <boost/mpl/iterator_tags.hpp>
0019 #include <boost/mpl/next.hpp>
0020 #include <boost/mpl/deref.hpp>
0021 #include <boost/mpl/aux_/lambda_spec.hpp>
0022 #include <boost/mpl/aux_/config/ctps.hpp>
0023 #include <boost/type_traits/is_same.hpp>
0024 
0025 namespace boost { namespace mpl { 
0026 
0027 namespace aux {
0028 
0029 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0030 
0031 template<
0032       typename Iterator
0033     , typename LastIterator
0034     , typename F
0035     >
0036 struct transform_iter
0037 {
0038     typedef Iterator base;
0039     typedef forward_iterator_tag category;
0040     typedef transform_iter< typename mpl::next<base>::type,LastIterator,F > next;
0041     
0042     typedef typename apply1<
0043           F
0044         , typename deref<base>::type
0045         >::type type;
0046 };
0047 
0048 template<
0049       typename LastIterator
0050     , typename F
0051     >
0052 struct transform_iter< LastIterator,LastIterator,F >
0053 {
0054     typedef LastIterator base;
0055     typedef forward_iterator_tag category;
0056 };
0057 
0058 #else
0059 
0060 template<
0061       typename Iterator
0062     , typename LastIterator
0063     , typename F
0064     >
0065 struct transform_iter;
0066 
0067 template< bool >
0068 struct transform_iter_impl 
0069 {
0070     template<
0071           typename Iterator
0072         , typename LastIterator
0073         , typename F
0074         >
0075     struct result_
0076     {
0077         typedef Iterator base;
0078         typedef forward_iterator_tag category;
0079         typedef transform_iter< typename mpl::next<Iterator>::type,LastIterator,F > next;
0080         
0081         typedef typename apply1<
0082               F
0083             , typename deref<Iterator>::type
0084             >::type type;
0085     };
0086 };
0087 
0088 template<>
0089 struct transform_iter_impl<true>
0090 {
0091     template<
0092           typename Iterator
0093         , typename LastIterator
0094         , typename F
0095         >
0096     struct result_
0097     {
0098         typedef Iterator base;
0099         typedef forward_iterator_tag category;
0100     };
0101 };
0102 
0103 template<
0104       typename Iterator
0105     , typename LastIterator
0106     , typename F
0107     >
0108 struct transform_iter
0109     : transform_iter_impl<
0110           ::boost::is_same<Iterator,LastIterator>::value
0111         >::template result_< Iterator,LastIterator,F >
0112 {
0113 };
0114 
0115 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
0116 
0117 } // namespace aux
0118 
0119 BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::transform_iter)
0120 
0121 }}
0122 
0123 #endif // BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED