Defined in word-range.hpp.
This namespace contains some functions for creating word_type objects in a compact form.
Functions | |
| std::string | operator""_p (const char *w) |
| Literal for defining word_type by parsing an algebraic expression. | |
| std::string | operator""_p (const char *w, size_t n) |
| Literal for defining std::string by parsing an algebraic expression. | |
| word_type | operator""_w (const char *w) |
| Literal for defining word_type over integers less than 10. | |
| word_type | operator""_w (const char *w, size_t n) |
| Literal for defining word_type over integers less than 10. | |
| std::string operator""_p | ( | const char * | w | ) |
See operator""_p for details.
| std::string operator""_p | ( | const char * | w, |
| size_t | n ) |
This operator provides a convenient concise means of constructing a std::string from an algebraic expression. For example, "((ab)^3cc)^2"_p equals "abababccabababcc", "(ab,ba)" equals "BAABabba" and "a^0"_p equals the empty string "".
This function has the following behaviour:
^ is treated as the power binary operator;, is treated as the commutator binary operator;"()^, " and in a-zA-Z0-9 are allowed.When using , as the commutator operator, it is not possible to specify what the inverse of each letter should be. Instead, it is assumed that the inverse of a lowercase letter is the corresponding uppercase letter, and the inverse of an uppercase letter is the corresponding lowercase letter. If this is requirement is not applicable for your use case, see commutator instead.
Additionally, it is not possible to specify commutators using square brackets. Round brackets must be used instead.
| w | the letters of the word. |
| n | the length of w (defaults to the length of w). |
| LibsemigroupsException | if the string cannot be parsed. |
| word_type operator""_w | ( | const char * | w | ) |
See operator""_w for details.
| word_type operator""_w | ( | const char * | w, |
| size_t | n ) |
This operator provides a convenient brief means of constructing a word_type from an sequence of literal integer digits or a string. For example, 0123_w produces the same output as word_type({0, 1, 2, 3}) and so too does "abcd"_w.
There are some gotchas and this operator should be used with some care:
w must consist of the integers \(\{0, \ldots, 9\}\) or the characters in a-zA-Z but not both.w starts with 0 and is follows by a value greater than 7, then it is necessary to enclose w in quotes. For example, 08_w will not compile because it is interpreted as an invalid octal. However "08"_w behaves as expected.w consists of characters in a-zA-Z, then the output is the same as that of ToWord::operator()(w), see operator()()| w | the letters of the word. |
| n | the length of w (defaults to the length of w). |
| LibsemigroupsException | if the input contains a mixture of integers and non-integers. |