tfel
Loading...
Searching...
No Matches
tfel::fsalgo::transform< N > Class Template Reference

transform performs an operation on objects More...

#include </home/runner/work/tfel/tfel/include/TFEL/FSAlgorithm/transform.hxx>

Static Public Member Functions

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)

Detailed Description

template<unsigned int N>
class tfel::fsalgo::transform< N >

transform performs an operation on objects

Template Parameters
Nnumber 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

Member Function Documentation

◆ exe() [1/2]

template<unsigned int N>
template<typename InputIterator, typename OutputIterator, typename UnaryFunction>
constexpr OutputIterator tfel::fsalgo::transform< N >::exe ( InputIterator p,
OutputIterator q,
UnaryFunction op )
inlinestaticconstexpr

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
InputIteratoriterator to the elements to be transformed.
OutputIteratoriterator to which the results are placed.
UnaryFunctionfunction used to perform the transformation.
Parameters
[in]piterator to the first element to be transformed
[in]qiterator to which the first result is placed
[in]opfunction 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
InputIterator1iterator to the first input range.
InputIterator2iterator to the second input range.
OutputIteratoriterator to which the results are placed.
BinaryFunctionfunction used to perform the transformation
Parameters
[in]piterator to the first element of the first input range
[in]qiterator to the first element of the second input range
[in]riterator to which the first result is placed
[in]opfunction 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: