libsemigroups
v3.6.3
C++ library for semigroups and monoids
Toggle main menu visibility
Loading...
Searching...
No Matches
types.hpp
1
//
2
// libsemigroups - C++ library for semigroups and monoids
3
// Copyright (C) 2019-2026 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
32
namespace
libsemigroups
{
41
47
template
<
typename
Given,
typename
Expected>
48
using
enable_if_is_same
49
= std::enable_if_t<std::is_same_v<Given, Expected>, Expected>;
50
54
//! or not currently knowable.
55
enum class
tril
{
57
FALSE
= 0,
59
TRUE
= 1,
61
unknown
= 2
62
};
63
67
//! be 2-sided, left, or right.
68
enum class
congruence_kind
{
70
onesided
= 1,
72
twosided
= 2
73
};
74
84
template
<
size_t
N>
85
struct
SmallestInteger
{
88
using
type
= std::conditional_t<
89
N >= 0x100000000,
90
uint64_t,
91
std::conditional_t<N >= 0x10000,
92
uint32_t,
93
std::conditional_t<N >= 0x100, uint16_t, uint8_t>>>;
94
};
95
97
using
letter_type
= size_t;
98
100
using
word_type
=
std::vector<letter_type>
;
101
103
using
relation_type
=
std::pair<word_type, word_type>
;
104
106
// There is undefined behaviour associated with std::char_traits and
107
// std::basic_string<uint8_t>. This only seems to present an issue in Cygwin,
108
// and in the conda feedstock tests. This alias was only used in v3.1.0 and
109
// is deprecated already in v3.1.1.
110
#pragma GCC diagnostic push
111
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
112
using
u8string
[[deprecated]] =
std::basic_string<uint8_t>
;
113
#pragma GCC diagnostic pop
115
}
// namespace libsemigroups
116
117
#endif
// LIBSEMIGROUPS_TYPES_HPP_
std::basic_string
libsemigroups::enable_if_is_same
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:48
libsemigroups::word_type
std::vector< letter_type > word_type
Type for a word over the generators of a semigroup.
Definition
types.hpp:99
libsemigroups::letter_type
size_t letter_type
Type for the index of a generator of a semigroup.
Definition
types.hpp:96
libsemigroups::relation_type
std::pair< word_type, word_type > relation_type
Type for a pair of word_type (a relation) of a semigroup.
Definition
types.hpp:102
libsemigroups::u8string
std::basic_string< uint8_t > u8string
Alias for strings over unsigned chars.
libsemigroups::tril
tril
Enum to indicate true, false or not currently knowable.
Definition
types.hpp:54
libsemigroups::congruence_kind
congruence_kind
Enum to indicate the sided-ness of a congruence.
Definition
types.hpp:67
libsemigroups::tril::FALSE
@ FALSE
Value representing false.
Definition
types.hpp:56
libsemigroups::tril::unknown
@ unknown
Value representing unknown (either true or false).
Definition
types.hpp:60
libsemigroups::tril::TRUE
@ TRUE
Value representing true.
Definition
types.hpp:58
libsemigroups::congruence_kind::twosided
@ twosided
Value representing a two-sided congruence.
Definition
types.hpp:71
libsemigroups::congruence_kind::onesided
@ onesided
Value representing a one-sided congruence.
Definition
types.hpp:69
libsemigroups
Namespace for everything in the libsemigroups library.
Definition
action.hpp:44
std::pair
libsemigroups::SmallestInteger
Type giving the smallest unsigned integer type that can represent a template.
Definition
types.hpp:84
libsemigroups::SmallestInteger::type
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:87
std::vector
include
libsemigroups
types.hpp
Generated by
1.18.0