annotate DEPENDENCIES/generic/include/boost/range/algorithm/transform.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 // Copyright Neil Groves 2009. Use, modification and
Chris@16 2 // distribution is subject to the Boost Software License, Version
Chris@16 3 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5 //
Chris@16 6 //
Chris@16 7 // For more information, see http://www.boost.org/libs/range/
Chris@16 8 //
Chris@16 9 #ifndef BOOST_RANGE_ALGORITHM_TRANSFORM_HPP_INCLUDED
Chris@16 10 #define BOOST_RANGE_ALGORITHM_TRANSFORM_HPP_INCLUDED
Chris@16 11
Chris@16 12 #include <boost/assert.hpp>
Chris@16 13 #include <boost/concept_check.hpp>
Chris@16 14 #include <boost/range/begin.hpp>
Chris@16 15 #include <boost/range/end.hpp>
Chris@16 16 #include <boost/range/concepts.hpp>
Chris@16 17 #include <algorithm>
Chris@16 18
Chris@16 19 namespace boost
Chris@16 20 {
Chris@16 21 namespace range
Chris@16 22 {
Chris@16 23
Chris@16 24 /// \brief template function transform
Chris@16 25 ///
Chris@16 26 /// range-based version of the transform std algorithm
Chris@16 27 ///
Chris@16 28 /// \pre SinglePassRange1 is a model of the SinglePassRangeConcept
Chris@16 29 /// \pre SinglePassRange2 is a model of the SinglePassRangeConcept
Chris@16 30 /// \pre OutputIterator is a model of the OutputIteratorConcept
Chris@16 31 /// \pre UnaryOperation is a model of the UnaryFunctionConcept
Chris@16 32 /// \pre BinaryOperation is a model of the BinaryFunctionConcept
Chris@16 33 template< class SinglePassRange1,
Chris@16 34 class OutputIterator,
Chris@16 35 class UnaryOperation >
Chris@16 36 inline OutputIterator
Chris@16 37 transform(const SinglePassRange1& rng,
Chris@16 38 OutputIterator out,
Chris@16 39 UnaryOperation fun)
Chris@16 40 {
Chris@16 41 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 42 return std::transform(boost::begin(rng),boost::end(rng),out,fun);
Chris@16 43 }
Chris@16 44
Chris@16 45 } // namespace range
Chris@16 46
Chris@16 47 namespace range_detail
Chris@16 48 {
Chris@16 49 template< class SinglePassTraversalReadableIterator1,
Chris@16 50 class SinglePassTraversalReadableIterator2,
Chris@16 51 class OutputIterator,
Chris@16 52 class BinaryFunction >
Chris@16 53 inline OutputIterator
Chris@16 54 transform_impl(SinglePassTraversalReadableIterator1 first1,
Chris@16 55 SinglePassTraversalReadableIterator1 last1,
Chris@16 56 SinglePassTraversalReadableIterator2 first2,
Chris@16 57 SinglePassTraversalReadableIterator2 last2,
Chris@16 58 OutputIterator out,
Chris@16 59 BinaryFunction fn)
Chris@16 60 {
Chris@101 61 for (; first1 != last1 && first2 != last2; ++first1, ++first2)
Chris@16 62 {
Chris@16 63 *out = fn(*first1, *first2);
Chris@16 64 ++out;
Chris@16 65 }
Chris@16 66 return out;
Chris@16 67 }
Chris@16 68 }
Chris@16 69
Chris@16 70 namespace range
Chris@16 71 {
Chris@16 72
Chris@16 73 /// \overload
Chris@16 74 template< class SinglePassRange1,
Chris@16 75 class SinglePassRange2,
Chris@16 76 class OutputIterator,
Chris@16 77 class BinaryOperation >
Chris@16 78 inline OutputIterator
Chris@16 79 transform(const SinglePassRange1& rng1,
Chris@16 80 const SinglePassRange2& rng2,
Chris@16 81 OutputIterator out,
Chris@16 82 BinaryOperation fun)
Chris@16 83 {
Chris@16 84 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 85 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 86 return boost::range_detail::transform_impl(
Chris@16 87 boost::begin(rng1), boost::end(rng1),
Chris@16 88 boost::begin(rng2), boost::end(rng2),
Chris@16 89 out, fun);
Chris@16 90 }
Chris@16 91
Chris@16 92 } // namespace range
Chris@16 93 using range::transform;
Chris@16 94 } // namespace boost
Chris@16 95
Chris@16 96 #endif // include guard