27#ifndef LIBSEMIGROUPS_CONSTANTS_HPP_
28#define LIBSEMIGROUPS_CONSTANTS_HPP_
39 constexpr T operator()() const noexcept {
40 static_assert(std::is_integral_v<T>,
41 "can only call Min with an integral type");
48 constexpr T operator()() const noexcept {
49 static_assert(std::is_integral_v<T>,
50 "can only call Max with an integral type");
55 template <
int64_t TOffset,
typename TMaxOrMin>
57 static_assert(std::is_same_v<TMaxOrMin, Max>
58 || std::is_same_v<TMaxOrMin, Min>,
59 "template parameter TMaxOrMin must be Max or Min");
62 Constant(Constant
const&) =
default;
63 Constant(Constant&&) =
default;
64 Constant& operator=(Constant
const&) =
default;
65 Constant& operator=(Constant&&) =
default;
66 ~Constant() =
default;
74 = std::enable_if_t<!std::is_enum_v<T> && std::is_integral_v<T>
75 && (std::is_signed_v<T>
76 || std::is_same_v<TMaxOrMin, Max>),
78 constexpr operator T() const noexcept {
79 return TMaxOrMin().template operator()<T>() + TOffset;
111 using LimitMax = detail::Constant<-2, detail::Max>;
166#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
171 template <
int64_t R,
typename S,
typename T>
172 constexpr bool operator==(Constant<R, S>
const& lhs,
173 T
const& rhs)
noexcept {
174 return lhs.operator T() == rhs;
177 template <
int64_t R,
typename S,
typename T>
179 Constant<R, S>
const& rhs)
noexcept {
180 return rhs.operator T() == lhs;
183 template <
int64_t R1,
typename S1,
int64_t R2,
typename S2>
184 constexpr bool operator==(Constant<R1, S1>
const&,
185 Constant<R2, S2>
const&)
noexcept {
186 return std::is_same_v<S1, S2> && R1 == R2;
191 template <
int64_t R,
typename S,
typename T>
192 constexpr bool operator!=(Constant<R, S>
const& lhs,
193 T
const& rhs)
noexcept {
194 return !(lhs == rhs);
197 template <
int64_t R,
typename S,
typename T>
199 Constant<R, S>
const& rhs)
noexcept {
200 return !(lhs == rhs);
203 template <
int64_t R1,
typename S1,
int64_t R2,
typename S2>
204 constexpr bool operator!=(Constant<R1, S1>
const& lhs,
205 Constant<R2, S2>
const& rhs)
noexcept {
206 return !(lhs == rhs);
211 template <
int64_t R,
typename S,
typename T>
212 constexpr bool operator>(Constant<R, S>
const& lhs, T
const& rhs)
noexcept {
216 template <
int64_t R,
typename S,
typename T>
217 constexpr bool operator>(T
const& lhs, Constant<R, S>
const& rhs)
noexcept {
221 template <
int64_t R,
typename S>
222 constexpr bool operator>(Constant<R, S>
const&,
223 Constant<R, S>
const&)
noexcept {
227 template <
int64_t R,
typename S>
228 constexpr bool operator<(Constant<R, S>
const&,
229 Constant<R, S>
const&)
noexcept {
240 template <
typename T,
typename SFINAE =
bool>
242 -> std::enable_if_t<std::is_integral_v<T>
243 || std::is_same_v<NegativeInfinity, T>,
250 template <
typename T,
typename SFINAE =
bool>
252 -> std::enable_if_t<std::is_integral_v<T>
253 || std::is_same_v<NegativeInfinity, T>,
259 template <
typename T,
typename SFINAE =
bool>
261 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
266 template <
typename T,
typename SFINAE =
bool>
268 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
273 template <
typename T,
typename SFINAE =
bool>
274 constexpr auto operator<(
LimitMax const& lhs, T
const& rhs)
noexcept
275 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
276 return lhs.operator T() < rhs;
280 template <
typename T,
typename SFINAE =
bool>
281 constexpr auto operator<(T
const& lhs,
LimitMax const& rhs)
noexcept
282 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
283 return lhs < rhs.operator T();
286 template <
typename T,
typename SFINAE = T>
287 constexpr auto operator-(
LimitMax const& lhs, T
const& rhs)
noexcept
288 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
289 return lhs.operator T() - rhs;
292 template <
typename T,
typename SFINAE = T>
293 constexpr auto operator-(T
const& lhs,
LimitMax const& rhs)
noexcept
294 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
295 return lhs - rhs.operator T();
300 template <
typename T,
typename SFINAE =
bool>
302 -> std::enable_if_t<std::is_integral_v<T>
303 || std::is_same_v<NegativeInfinity, T>,
315 template <
typename T,
typename SFINAE =
bool>
317 -> std::enable_if_t<std::is_integral_v<T>
318 || std::is_same_v<NegativeInfinity, T>,
324 template <
typename T,
typename SFINAE =
bool>
326 -> std::enable_if_t<std::is_integral_v<T>
327 || std::is_same_v<NegativeInfinity, T>,
339 template <
typename T,
typename SFINAE =
bool>
341 -> std::enable_if_t<std::is_integral_v<T>
342 || std::is_same_v<NegativeInfinity, T>,
349 template <
typename T,
typename SFINAE =
bool>
351 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
362 template <
typename T,
typename SFINAE =
bool>
364 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
369 template <
typename T,
typename SFINAE =
bool>
371 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
382 template <
typename T,
typename SFINAE =
bool>
384 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
390 template <
typename T,
typename SFINAE =
bool>
392 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
402 template <
typename T,
typename SFINAE =
bool>
404 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
409 template <
typename T,
typename SFINAE =
bool>
411 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
421 template <
typename T,
typename SFINAE =
bool>
423 -> std::enable_if_t<std::is_integral_v<T>, SFINAE> {
bool operator<=(Bipartition const &x, Bipartition const &y)
Compare bipartitions.
Definition bipart.hpp:1737
bool operator>=(Bipartition const &x, Bipartition const &y)
Compare bipartitions.
Definition bipart.hpp:1759
bool operator>(Bipartition const &x, Bipartition const &y)
Compare bipartitions.
Definition bipart.hpp:1748
bool operator!=(Bipartition const &x, Bipartition const &y)
Check bipartitions for inequality.
Definition bipart.hpp:1727
detail::Constant< 0, detail::Max > Undefined
Type for undefined values.
Definition constants.hpp:99
NegativeInfinity const NEGATIVE_INFINITY
Value for negative infinity.
detail::Constant<-1, detail::Max > PositiveInfinity
Type for positive infinity.
Definition constants.hpp:105
Undefined const UNDEFINED
Value for something undefined.
detail::Constant< 0, detail::Min > NegativeInfinity
Type for negative infinity.
Definition constants.hpp:117
PositiveInfinity const POSITIVE_INFINITY
Value for positive infinity.
LimitMax const LIMIT_MAX
Value for the maximum of something.
detail::Constant<-2, detail::Max > LimitMax
Type for the maximum value of something.
Definition constants.hpp:111
bool operator==(Presentation< Word > const &lhop, Presentation< Word > const &rhop)
Compare for equality.
Definition presentation.hpp:3378
Namespace for everything in the libsemigroups library.
Definition action.hpp:44