Console Library 8.0.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
console::gen::reduce_t< T, BinaryOp > Class Template Reference

归约适配器,将生成器所有元素归约为单个值。 More...

#include <gextra.h>

Public Member Functions

 reduce_t (T init, BinaryOp op)
 构造函数。

Private Attributes

T init_
BinaryOp op_

Friends

template<class Gen>
T operator| (Gen gen, reduce_t r)
 管道操作符,执行归约。

Detailed Description

template<class T, class BinaryOp>
class console::gen::reduce_t< T, BinaryOp >

归约适配器,将生成器所有元素归约为单个值。

Template Parameters
T初始值和结果类型。
BinaryOp二元操作符类型。

Constructor & Destructor Documentation

◆ reduce_t()

template<class T, class BinaryOp>
console::gen::reduce_t< T, BinaryOp >::reduce_t ( T init,
BinaryOp op )
inline

构造函数。

Parameters
init初始值。
op二元操作符。

◆ operator|

template<class T, class BinaryOp>
template<class Gen>
T operator| ( Gen gen,
reduce_t< T, BinaryOp > r )
friend

管道操作符,执行归约。

Parameters
gen源生成器。
r归约适配器。
Returns
T 归约结果。

Member Data Documentation

◆ init_

template<class T, class BinaryOp>
T console::gen::reduce_t< T, BinaryOp >::init_
private

◆ op_

template<class T, class BinaryOp>
BinaryOp console::gen::reduce_t< T, BinaryOp >::op_
private

The documentation for this class was generated from the following file: