negate Helper

template<size_t MaxDeps = 8, typename Source>
auto RxESP32::Helpers::Numerical::negate(Source &source, const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {})

Negate signal value.

Creates a Computed that returns the negative of the source value.

Since

v0.1.0

Signal<int> value(42);
auto negated = negate(value);
Serial.println(negated.get()); // -42
value.set(10);
Serial.println(negated.get()); // -10

Warning

Only accepts arithmetic types (integral and floating-point).

Template Parameters:
size_t MaxDeps = 8

Maximum number of dependents for the computed signal.

Parameters:
Source &source

Source (determines result type).

const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {}

Optional Computed configuration.

Returns:

Computed with negated values.

See Also