libsemigroups  v3.6.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
print.hpp
1//
2// libsemigroups - C++ library for semigroups and monoids
3// Copyright (C) 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#ifndef LIBSEMIGROUPS_DETAIL_PRINT_HPP_
19#define LIBSEMIGROUPS_DETAIL_PRINT_HPP_
20
21#include <string> // for basic_string
22#include <string_view> // for std::string_view
23#include <vector> // for vector
24
25#include "fmt.hpp"
26
27namespace libsemigroups {
28 namespace detail {
29 [[nodiscard]] bool isprint(std::string_view alphabet);
30
31 [[nodiscard]] std::string to_printable(char c);
32
33 [[nodiscard]] std::string to_printable(std::string const& alphabet);
34
35 template <typename Int>
36 [[nodiscard]] std::string
37 to_printable(std::basic_string<Int> const& alphabet) {
38 return fmt::format("{}",
39 std::vector<int>(alphabet.begin(), alphabet.end()));
40 }
41
42 template <typename Thing>
43 [[nodiscard]] std::string to_printable(Thing const& thing) {
44 return fmt::format("{}", thing);
45 }
46 } // namespace detail
47} // namespace libsemigroups
48
49#endif // LIBSEMIGROUPS_DETAIL_PRINT_HPP_
T begin(T... args)
T end(T... args)
Namespace for everything in the libsemigroups library.
Definition action.hpp:44