transform performs an operation on objects
More...
#include </home/runner/work/tfel/tfel/include/TFEL/FSAlgorithm/transform.hxx>
|
| template<typename InputIterator, typename OutputIterator, typename UnaryFunction> |
| static constexpr OutputIterator | exe (InputIterator p, OutputIterator q, UnaryFunction op) |
| template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename BinaryFunction> |
| static constexpr OutputIterator | exe (InputIterator1 p, InputIterator2 q, OutputIterator r, BinaryFunction op) |
template<unsigned int N>
class tfel::fsalgo::transform< N >
transform performs an operation on objects
- Template Parameters
-
| N | number of elements to be transformed. |
This documentation is mostly inspired from: http://www.sgi.com/tech/stl/transform.html
- See also
- transform.cxx for some elementary tests.
- Author
- Thomas Helfer
- Date
- 30/06/2006
◆ exe() [1/2]
template<unsigned int N>
template<typename InputIterator, typename OutputIterator, typename UnaryFunction>
The first version of transform::exe performs the operation op(*i) for each iterator i in the range [first, first+N), and assigns the result of that operation to *o, where o is the corresponding output iterator. The return value is result + N.
- Template Parameters
-
| InputIterator | iterator to the elements to be transformed. |
| OutputIterator | iterator to which the results are placed. |
| UnaryFunction | function used to perform the transformation. |
- Parameters
-
| [in] | p | iterator to the first element to be transformed |
| [in] | q | iterator to which the first result is placed |
| [in] | op | function used to perform the transformation |
- Returns
- OutputIterator iterator after the last element transformed.
- Precondition
- InputIterator must be a model of Input Iterator.
- OutputIterator must be a model of Output Iterator.
- UnaryFunction must be a model of Unary Function.
- InputIterator's value type must be convertible to UnaryFunction's argument type.
- UnaryFunction's result type must be convertible to a type in OutputIterator's set of value types.
- Author
- Thomas Helfer
- Date
- 30/06/2006
◆ exe() [2/2]
template<unsigned int N>
template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename BinaryFunction>
| constexpr OutputIterator tfel::fsalgo::transform< N >::exe |
( |
InputIterator1 | p, |
|
|
InputIterator2 | q, |
|
|
OutputIterator | r, |
|
|
BinaryFunction | op ) |
|
inlinestaticconstexpr |
The second version of transform is very similar, except that it uses a Binary Function instead of a Unary Function: it performs the operation op(*i1, *i2) for each iterator i1 in the range [first1, last1) and assigns the result to *o, where i2 is the corresponding iterator in the second input range and where o is the corresponding output iterator. That is, for each n such that 0 <= i < N, it performs the assignment *(result
- i) = op(*(first1 + i), *(first2 + i). The return value is result + N.
- Template Parameters
-
| InputIterator1 | iterator to the first input range. |
| InputIterator2 | iterator to the second input range. |
| OutputIterator | iterator to which the results are placed. |
| BinaryFunction | function used to perform the transformation |
- Parameters
-
| [in] | p | iterator to the first element of the first input range |
| [in] | q | iterator to the first element of the second input range |
| [in] | r | iterator to which the first result is placed |
| [in] | op | function used to perform the transformation |
- Returns
- OutputIterator iterator after the last element transformed.
- Precondition
- InputIterator1 and InputIterator2 must be models of Input Iterator.
- OutputIterator must be a model of Output Iterator.
- BinaryFunction must be a model of Binary Function.
- InputIterator1's and InputIterator2's value types must be convertible, respectively, to BinaryFunction's first and second argument types.
- UnaryFunction's result type must be convertible to a type in OutputIterator's set of value types.
- Author
- Thomas Helfer
- Date
- 30/06/2006
The documentation for this class was generated from the following file: