lambda式を直接適用可能なmake_transform_iterator

id:Cryolite:20040519#p2で取り上げたコードの改訂版.

#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/lambda/lambda.hpp>

template<class T, class Iterator>
inline
boost::transform_iterator<
  boost::lambda::lambda_functor<T>,
  Iterator,
  typename boost::lambda::lambda_functor<T>::template sig<
    boost::tuples::tuple<
      boost::lambda::lambda_functor<T>,
      typename boost::iterator_value<Iterator>::type
    >
  >::type
>
make_transform_iterator(Iterator it, boost::lambda::lambda_functor<T> l)
{
  return boost::transform_iterator<
      boost::lambda::lambda_functor<T>,
      Iterator,
      typename boost::lambda::lambda_functor<T>::template sig<
        boost::tuples::tuple<
          boost::lambda::lambda_functor<T>,
          typename boost::iterator_value<Iterator>::type
        >
      >::type
    >(it, l);
}