KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches
kumi::function::foldable< T > Class Template Reference

Functional wrapper for values to facilitate pipelined transformations. More...

#include <kumi/functional/monadic.hpp>

Detailed Description

template<typename T>
class kumi::function::foldable< T >

Functional wrapper for values to facilitate pipelined transformations.

kumi::function::foldable provides a lightweight wrapper that enables functional-style chaining of operations using the >> and << operators. It acts as an identity functor, allowing a value to be transformed through a sequence of callables without manual temporary variables.

Template Parameters
TType of the value stored inside kumi::foldable.

Public Member Functions

constexpr auto operator() () const noexcept
 Finalizes the fold.

Friends

template<typename C>
constexpr decltype(auto) operator<< (C &&c, foldable &&f)
 Pipelines the value contained in the foldable into a unary callable, chaining computation from right to left.
template<typename C>
constexpr decltype(auto) operator>> (foldable &&f, C &&c)
 Pipelines the value contained in the foldable into a unary callable, chaining computation from left to right.

(Note that these are not member symbols.)

template<typename T>
 foldable (T &&t) -> foldable< std::unwrap_ref_decay_t< T > >
 kumi::function::foldable deduction guide