kumi v3.1.0
Exquisite Epidote
 
Loading...
Searching...
No Matches
kumi::monoid Concept Reference

Concept specifying a type is a Monoid
More...

#include <kumi/utils/concepts.hpp>

Detailed Description

Concept specifying a type is a Monoid

A type T models kumi::monoid if it's a binary associative callable equipped with an identity element acting as the neutral element for that operation.

The identity is defined so that the following property holds for the operation.

monoid(x, indentity) = monoid(identity, x) = x
Concept specifying a type is a Monoid
Definition concepts.hpp:315
Note
The operation is not required to be commutative; that is monoid(x,y) and monoid(y,x) may yield different results. (Ie : the monoid is not necessarily abelian)

Concept definition

template<typename T>
concept kumi::monoid = []()
{
using M = std::remove_cvref_t<T>;
return requires(M m) {
{ M::identity };
{ M{}(M::identity, M::identity) };
};
}()