KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches
kumi::function::scannable< F, V > Class Template Reference

Functional wrapper that accumulates state during a transformation chain. More...

#include <kumi/functional/monadic.hpp>

Detailed Description

template<typename F, typename V>
class kumi::function::scannable< F, V >

Functional wrapper that accumulates state during a transformation chain.

kumi::scannable tracks both a current value and a transformation history. As the value is piped through callables, the previous state is bound into the underlying function, effectively performing a "scan" or "prefix sum" at the type level.

Template Parameters
FThe accumulated function state (partial applications).
VThe current result value.

Public Member Functions

constexpr decltype(auto) operator() () const noexcept
 Finalizes the scan.

Friends

template<typename C>
constexpr decltype(auto) operator<< (C &&c, scannable &&s)
 Pipelines the current value into a unary callable and accumulates the operation into the function state, chaining computations from right to left.
template<typename C>
constexpr decltype(auto) operator>> (scannable &&s, C &&c)
 Pipelines the current value into a unary callable and accumulates the operation into the function state, chaining computations from left to right.

(Note that these are not member symbols.)

template<typename F, typename T>
 scannable (F &&f, T &&t) -> scannable< F, std::unwrap_ref_decay_t< T > >
 kumi::function::scannable deduction guide