Console Library 8.0.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
console::ops::modulus_t Struct Reference

取模函数子。 More...

#include <gextra.h>

Public Member Functions

template<class T, class U>
auto operator() (T a, U b) const -> decltype(a % b)
 对两个值执行取模。

Detailed Description

取模函数子。

等价于 operator,支持任意类型(只要定义了 operator%)。 用于 reduce 等需要二元操作的场景。

Note
若是算术取模语义,调用者需确保除数不为零,否则行为由 operator% 决定。

Member Function Documentation

◆ operator()()

template<class T, class U>
auto console::ops::modulus_t::operator() ( T a,
U b ) const -> decltype(a % b)
inline

对两个值执行取模。

Template Parameters
T左操作数类型。
U右操作数类型。
Parameters
a左操作数。
b右操作数。
Returns
decltype(a % b) 两数之模。

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