Constants¶
libsemigroups
contains certain constant values, which are described in this
section. The values below correspond to integer values (in some sense). All
of the constants in this section can be implicitly converted to any integral
type, and have a value specified by
std::numeric_limits<T>::max/min()
minus a compiletime offset (where T
is a member function template, and
can hence be any integral type), and we overload operator==
,
operator!=
, operator<
, and operator>
the constants
defined below and for certain integral type. So, the constants can be used as
if it was an integral type (say, 1
, although the precise value is not
defined), for the purposes of storing it in a data member and for comparisons.
This allows us to avoid duplicating code for constants like
UNDEFINED
, and makes UNDEFINED
more straightforward to
use.
This approach also has some drawbacks, if, for example, UNDEFINED
is
implicitly converted to two different integral types and then these are
compared, this will yield false
, and so ==
of
UNDEFINED
and itself is not transitive, so beware.
using namespace libsemigroups;
UNDEFINED != 0; // true
POSITIVE_INFINITY > 0; // true
POSITIVE_INFINITY > NEGATIVE_INFINITY; // true

LimitMax const libsemigroups::LIMIT_MAX¶
This variable represents the maximum value that certain function parameters can have.
LIMIT_MAX is comparable via
==
,!=
,<
,>
with any integral value (signed or unsigned), and is comparable to any other constant via==
and!=
, but not by<
and>
.

Undefined const libsemigroups::UNDEFINED¶
This variable is used to indicate that a value is undefined.
UNDEFINED is comparable with any integral value (signed or unsigned) or constant via
==
and!=
but not via<
or>
.

NegativeInfinity const libsemigroups::NEGATIVE_INFINITY¶
This variable represents \(\infty\).
NEGATIVE_INFINITY is comparable via
==
,!=
,<
,>
with any signed integral value and with POSITIVE_INFINITY, and is comparable to any other constant via==
and!=
.

PositiveInfinity const libsemigroups::POSITIVE_INFINITY¶
This variable represents \(\infty\).
POSITIVE_INFINITY is comparable via
==
,!=
,<
,>
with any integral value (signed or unsigned) and with NEGATIVE_INFINITY, and is comparable to any other constant via==
and!=
, but not by<
and>
.

constexpr std::chrono::nanoseconds libsemigroups::FOREVER = std::chrono::nanoseconds::max()¶
A pseudonym for std::chrono::nanoseconds::max().