PageRenderTime 14ms CodeModel.GetById 6ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/mpl/aux_/transform_iter.hpp

http://hadesmem.googlecode.com/
C++ Header | 123 lines | 92 code | 21 blank | 10 comment | 0 complexity | 27798e0e27cba3020e916032de70d86c MD5 | raw file
  1
  2#ifndef BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED
  3#define BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED
  4
  5// Copyright Aleksey Gurtovoy 2000-2004
  6//
  7// Distributed under the Boost Software License, Version 1.0. 
  8// (See accompanying file LICENSE_1_0.txt or copy at 
  9// http://www.boost.org/LICENSE_1_0.txt)
 10//
 11// See http://www.boost.org/libs/mpl for documentation.
 12
 13// $Id: transform_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
 14// $Date: 2008-10-11 17:19:02 +1100 (Sat, 11 Oct 2008) $
 15// $Revision: 49267 $
 16
 17#include <boost/mpl/apply.hpp>
 18#include <boost/mpl/iterator_tags.hpp>
 19#include <boost/mpl/next.hpp>
 20#include <boost/mpl/deref.hpp>
 21#include <boost/mpl/aux_/lambda_spec.hpp>
 22#include <boost/mpl/aux_/config/ctps.hpp>
 23#include <boost/type_traits/is_same.hpp>
 24
 25namespace boost { namespace mpl { 
 26
 27namespace aux {
 28
 29#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 30
 31template<
 32      typename Iterator
 33    , typename LastIterator
 34    , typename F
 35    >
 36struct transform_iter
 37{
 38    typedef Iterator base;
 39    typedef forward_iterator_tag category;
 40    typedef transform_iter< typename mpl::next<base>::type,LastIterator,F > next;
 41    
 42    typedef typename apply1<
 43          F
 44        , typename deref<base>::type
 45        >::type type;
 46};
 47
 48template<
 49      typename LastIterator
 50    , typename F
 51    >
 52struct transform_iter< LastIterator,LastIterator,F >
 53{
 54    typedef LastIterator base;
 55    typedef forward_iterator_tag category;
 56};
 57
 58#else
 59
 60template<
 61      typename Iterator
 62    , typename LastIterator
 63    , typename F
 64    >
 65struct transform_iter;
 66
 67template< bool >
 68struct transform_iter_impl 
 69{
 70    template<
 71          typename Iterator
 72        , typename LastIterator
 73        , typename F
 74        >
 75    struct result_
 76    {
 77        typedef Iterator base;
 78        typedef forward_iterator_tag category;
 79        typedef transform_iter< typename mpl::next<Iterator>::type,LastIterator,F > next;
 80        
 81        typedef typename apply1<
 82              F
 83            , typename deref<Iterator>::type
 84            >::type type;
 85    };
 86};
 87
 88template<>
 89struct transform_iter_impl<true>
 90{
 91    template<
 92          typename Iterator
 93        , typename LastIterator
 94        , typename F
 95        >
 96    struct result_
 97    {
 98        typedef Iterator base;
 99        typedef forward_iterator_tag category;
100    };
101};
102
103template<
104      typename Iterator
105    , typename LastIterator
106    , typename F
107    >
108struct transform_iter
109    : transform_iter_impl<
110          ::boost::is_same<Iterator,LastIterator>::value
111        >::template result_< Iterator,LastIterator,F >
112{
113};
114
115#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
116
117} // namespace aux
118
119BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::transform_iter)
120
121}}
122
123#endif // BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED