Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
transform.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_TRANSFORM_HPP
9#define ADOBE_ALGORITHM_TRANSFORM_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15
16#include <algorithm>
17#include <functional>
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
31/**************************************************************************************************/
37template <class InputIterator, class OutputIterator, class UnaryOperation>
38inline OutputIterator transform(InputIterator first, InputIterator last, OutputIterator result,
39 UnaryOperation op) {
40 return std::transform(first, last, result, std::bind(op, std::placeholders::_1));
41}
42
48template <class InputRange, class OutputIterator, class UnaryOperation>
49inline OutputIterator transform(InputRange& range, OutputIterator result, UnaryOperation op) {
50 return adobe::transform(boost::begin(range), boost::end(range), result, op);
51}
52
53
59template <class InputRange, class OutputIterator, class UnaryOperation>
60inline OutputIterator transform(const InputRange& range, OutputIterator result, UnaryOperation op) {
61 return adobe::transform(boost::begin(range), boost::end(range), result, op);
62}
63
64
70template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
71inline OutputIterator transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
72 OutputIterator result, BinaryOperation binary_op) {
73 return std::transform(first1, last1, first2, result,
74 std::bind(binary_op, std::placeholders::_1, std::placeholders::_2));
75}
76
82template <class InputRange1, class InputIterator2, class OutputIterator, class BinaryOperation>
83inline OutputIterator transform(InputRange1& range1, InputIterator2 first2, OutputIterator result,
84 BinaryOperation binary_op) {
85 return adobe::transform(boost::begin(range1), boost::end(range1), first2, result, binary_op);
86}
87
93template <class InputRange1, class InputIterator2, class OutputIterator, class BinaryOperation>
94inline OutputIterator transform(const InputRange1& range1, InputIterator2 first2,
95 OutputIterator result, BinaryOperation binary_op) {
96 return adobe::transform(boost::begin(range1), boost::end(range1), first2, result, binary_op);
97}
98
99/**************************************************************************************************/
100
101} // namespace adobe
102
103/**************************************************************************************************/
104
105#endif
106
107/**************************************************************************************************/
OutputIterator transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op)
transform implementation
Definition transform.hpp:38