map Helper¶
-
template<size_t MaxDeps = 8, typename Transformer, typename Source>
auto RxESP32::Helpers::Transformation::map(Source &source, Transformer &&transformer, const typename Computed<decltype(transformer(source.get())), 1, MaxDeps>::Options &options = {})¶ Transform source value using a mapping function.
Creates a Computed that applies a transformation to the source’s value.
- Since
v0.1.0
Signal<int> celsius(25); // Computed fahrenheit with return type int (auto-deduced) auto fahrenheit = map(celsius, [](int c) { return c * 9 / 5 + 32; }); Serial.println(fahrenheit.get()); // 77Warning
Transformer must accept source value type and return the desired result type.
See Also¶
Transformation Helpers - Overview