26 #include <unordered_set> 42 template <
class C,
class T>
43 size_t index_of(C
const& container, T
const& element) {
45 "C must be a container with T as value_type.");
46 return static_cast<size_t>(
47 std::distance(container.begin(),
48 std::find(container.begin(), container.end(), element)));
70 std::to_string(state_index)) {}
77 char const* what_arg =
"Cannot find the given symbol.")
91 std::to_string(symbol_index)) {}
97 struct hash<valarray<bool>> {
98 inline size_t operator()(valarray<bool>
const& value)
const {
100 for (
bool v : value) {
109 struct equal_to<valarray<bool>> {
110 inline bool operator()(valarray<bool>
const& lhs,
111 valarray<bool>
const& rhs)
const {
112 return (lhs.size() == rhs.size() && (lhs == rhs).
min() ==
true);
state_not_found(std::string const &state)
Constructs an exception object incorporating the given state name in its message. ...
symbol_not_found(std::string &&what_arg)
Signals that an input symbol was used that the FA doesn't recognize.
size_t index_of(C const &container, T const &element)
Basically Java's List interface's indexOf, but as a non-member function and returning the container's...
symbol_not_found(size_t symbol_index)
Constructs an exception object incorporating the given symbol index in its message.
state_not_found(char const *what_arg="Cannot find the given state.")
Constructs an exception object with the given message.
std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t > converter
Converts between UTF-8-encoded and UTF-32-encoded strings.
Signals that a state was mentioned that isn't part of the FA.
symbol_not_found(char const *what_arg="Cannot find the given symbol.")
Constructs an exception object with the given message.
Where this library lives.
state_not_found(size_t state_index)
Constructs an exception object incorporating the given state index in its message.
state_not_found(std::string &&what_arg)
symbol_not_found(char32_t symbol)
Constructs an exception object incorporating the given symbol in its message.