1 #ifndef IDENTITYTRANSFORM_HPP
2 #define IDENTITYTRANSFORM_HPP 1
9 #include <boost/range.hpp>
11 #include <boost/range/algorithm.hpp>
12 #include <boost/range/algorithm_ext.hpp>
40 template <
typename Iterator1,
typename Iterator2 = Iterator1>
55 typedef boost::iterator_range<Iterator1> RandomAccessRange1;
56 typedef boost::iterator_range<Iterator2> RandomAccessRange2;
62 typedef typename std::iterator_traits<Iterator1>::value_type input_type;
63 typedef typename std::iterator_traits<Iterator2>::value_type output_type;
65 typedef std::function< output_type ( input_type ) > transform_type;
68 RandomAccessRange1 range1_;
69 RandomAccessRange2 range2_;
81 Identity (Iterator1 first1, Iterator1 last1, Iterator2 first2)
82 : range1_ (std::make_pair(first1, last1))
83 , range2_ (std::make_pair(first2, first2 + boost::distance(range1_)))
89 template <
typename RandomAccessRangeIn1,
typename RandomAccessRangeIn2>
90 Identity (RandomAccessRangeIn1& range1, RandomAccessRangeIn2& range2)
112 boost::copy(range1_, boost::begin(range2_));
116 exec_inverse_transform(
void)
118 boost::copy(range2_, boost::begin(range1_));