Invert
20.9.0
Invert an input range.
template <typename TInput>
class invert : public etl::unary_function<TInput, TInput>
TInput The input data type.
____________________________________________________________________________________________________
invert()
offset = 0
minuend = etl::numeric_limits<TInput>::is_signed) ? TInput(0)
: etl::numeric_limits<TInput>::max())
If the type is signed then the input values have their sign changed.
i.e. 10 => -10, -10 => 10.
If the type is unsigned then the input values are subtracted from the type's maximum value.
invert(TInput offset, TInput minuend)
Sets the offset and minuend.
____________________________________________________________________________________________________
TInput operator()(TInput value) const
Invert a value.
Calculates minuend - (value - offset)
____________________________________________________________________________________________________
Example
std::array<int, 10> input =
{
10, 11, 12, 13, 14, 15, 16, 17, 18, 19
};
std::array<int, 10> output;
etl::invert<int> invert(10, 100);
std::transform(input.begin(), input.end(), output.begin(), invert);