ALP User Documentation 0.7.alpha
Algebraic Programming User Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Monoid< _OP, _ID > Class Template Reference

A generalised monoid. More...

#include <monoid.hpp>

Public Types

typedef _OP::D1 D1
 The left-hand side input domain.
 
typedef _OP::D2 D2
 The right-hand side input domain.
 
typedef _OP::D3 D3
 The output domain.
 
template<typename IdentityType >
using Identity = _ID< IdentityType >
 The underlying identity.
 
typedef _OP Operator
 The type of the underlying operator.
 

Public Member Functions

 Monoid ()
 Constructor that infers a default operator, given the operator type.
 
template<typename D >
constexpr D getIdentity () const
 Retrieves the identity corresponding to this monoid.
 
Operator getOperator () const
 Retrieves the underlying operator.
 

Detailed Description

template<class _OP, template< typename > class _ID>
class grb::Monoid< _OP, _ID >

A generalised monoid.

Template Parameters
_OPThe monoid operator.
_IDThe monoid identity (the ‘0’).

Constructor & Destructor Documentation

◆ Monoid()

Monoid ( )
inline

Constructor that infers a default operator, given the operator type.

Useful for stateless operators.

Member Function Documentation

◆ getIdentity()

constexpr D getIdentity ( ) const
inlineconstexpr

Retrieves the identity corresponding to this monoid.

The identity value will be cast to the requested domain.

Template Parameters
DThe requested domain of the identity.
Returns
The identity corresponding to this monoid, cast to the requested domain.

◆ getOperator()

Operator getOperator ( ) const
inline

Retrieves the underlying operator.

Returns
The underlying operator. Any state is copied.

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