libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
types.hpp
1//
2// libsemigroups - C++ library for semigroups and monoids
3// Copyright (C) 2019-2025 James D. Mitchell
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17//
18
19#ifndef LIBSEMIGROUPS_TYPES_HPP_
20#define LIBSEMIGROUPS_TYPES_HPP_
21
22#include <cstddef> // for size_t
23#include <cstdint> // for uint8_t, uint16_t, uint32_t, uint64_t
24#include <string_view> // for string_view
25#include <type_traits> // for conditional
26#include <utility> // for pair
27#include <vector> // for vector
28
29#include "detail/fmt.hpp"
30#include <magic_enum/magic_enum.hpp>
31
32namespace libsemigroups {
43
49 template <typename Given, typename Expected>
51 = std::enable_if_t<std::is_same_v<Given, Expected>, Expected>;
52
56 //! or not currently knowable.
57 enum class tril {
59 FALSE = 0,
61 TRUE = 1,
63 unknown = 2
64 };
65
69 //! be 2-sided, left, or right.
70 enum class congruence_kind {
72 onesided = 1,
74 twosided = 2
75 };
76
86 template <size_t N>
87 struct SmallestInteger {
90 using type = std::conditional_t<
91 N >= 0x100000000,
92 uint64_t,
93 std::conditional_t<N >= 0x10000,
94 uint32_t,
95 std::conditional_t<N >= 0x100, uint16_t, uint8_t>>>;
96 };
97
99 using letter_type = size_t;
100
103
106
108} // namespace libsemigroups
109
110#endif // LIBSEMIGROUPS_TYPES_HPP_
std::enable_if_t< std::is_same_v< Given, Expected >, Expected > enable_if_is_same
Alias equal to the second template parameter if both template parameters are equal.
Definition types.hpp:50
std::vector< letter_type > word_type
Type for a word over the generators of a semigroup.
Definition types.hpp:101
size_t letter_type
Type for the index of a generator of a semigroup.
Definition types.hpp:98
std::pair< word_type, word_type > relation_type
Type for a pair of word_type (a relation) of a semigroup.
Definition types.hpp:104
tril
Enum to indicate true, false or not currently knowable.
Definition types.hpp:56
congruence_kind
Enum to indicate the sided-ness of a congruence.
Definition types.hpp:69
@ FALSE
Value representing false.
Definition types.hpp:58
@ unknown
Value representing unknown (either true or false).
Definition types.hpp:62
@ TRUE
Value representing true.
Definition types.hpp:60
@ twosided
Value representing a two-sided congruence.
Definition types.hpp:73
@ onesided
Value representing a one-sided congruence.
Definition types.hpp:71
Namespace for everything in the libsemigroups library.
Definition action.hpp:44
Type giving the smallest unsigned integer type that can represent a template.
Definition types.hpp:86
std::conditional_t< N >=0x100000000, uint64_t, std::conditional_t< N >=0x10000, uint32_t, std::conditional_t< N >=0x100, uint16_t, uint8_t > > > type
Definition types.hpp:89