The Group
concept represents Monoid
s where all objects have an inverse w.r.t. the Monoid
's binary operation.
A Group is an algebraic structure built on top of a Monoid
which adds the ability to invert the action of the Monoid
's binary operation on any element of the set. Specifically, a Group
is a Monoid
(S, +)
such that every element s
in S
has an inverse (say ‘s’`) which is such that
There are many examples of Group
s, one of which would be the additive Monoid
on integers, where the inverse of any integer n
is the integer n
. The method names used here refer to exactly this model.
minus
minus
is specified, the negate
method is defaulted by setting negate
negate
is specified, the minus
method is defaulted by setting For all objects x
of a Group
G
, the following laws must be satisfied:
Monoid
A data type T
is arithmetic if std::is_arithmetic<T>::value
is true. For a nonboolean arithmetic data type T
, a model of Group
is automatically defined by setting
bool
is the same as for not providing a Monoid
model.Let A
and B
be two Group
s. A function f : A > B
is said to be a Group morphism if it preserves the group structure between A
and B
. Rigorously, for all objects x, y
of data type A
,
Because of the Group
structure, it is easy to prove that the following will then also be satisfied:
Functions with these properties interact nicely with Group
s, which is why they are given such a special treatment.
Variables  
constexpr auto  boost::hana::minus 
Subtract two elements of a group. More...  
constexpr auto  boost::hana::negate 
Return the inverse of an element of a group. More...  

constexpr 
#include <boost/hana/fwd/minus.hpp>
Subtract two elements of a group.
Specifically, this performs the Monoid
operation on the first argument and on the inverse of the second argument, thus being equivalent to:
The minus
method is "overloaded" to handle distinct data types with certain properties. Specifically, minus
is defined for distinct data types A
and B
such that
A
and B
share a common data type C
, as determined by the common
metafunctionA
, B
and C
are all Group
s when taken individuallyto<C> : A > B
and to<C> : B > C
are Group
embeddings, as determined by the is_embedding
metafunction.The definition of minus
for data types satisfying the above properties is obtained by setting

constexpr 
#include <boost/hana/fwd/negate.hpp>
Return the inverse of an element of a group.