Defined in word-range.hpp.
This class implements a range object for strings and produces the same output as WordRange() | ToString("ab"), but is more convenient in some cases.
The order and range of the words in a StringRange instance can be set using the member functions:
Public Types | |
| using | output_type = std::string const& |
| The type of the output of the range object. | |
| using | size_type = typename std::vector<std::string>::size_type |
| Alias for the size type. | |
Static Public Attributes | |
| static constexpr bool | is_finite = true |
| Value indicating that the range is finite. | |
| static constexpr bool | is_idempotent = true |
Public Member Functions | |
| StringRange () | |
| Default constructor. | |
| StringRange (StringRange &&) | |
| Default move constructor. | |
| StringRange (StringRange const &) | |
| Default copy constructor. | |
| std::string const & | alphabet () const noexcept |
| The current alphabet. | |
| StringRange & | alphabet (std::string const &x) |
| Set the alphabet. | |
| bool | at_end () const noexcept |
| Check if the range object is exhausted. | |
| auto | begin () const noexcept |
| Returns an input iterator pointing to the first string in the range. | |
| size_t | count () const noexcept |
| The actual size of the range. | |
| auto | end () const noexcept |
| Returns an input iterator pointing one beyond the last string in the range. | |
| std::string | first () const noexcept |
| The current first string in the range. | |
| StringRange & | first (std::string const &frst) |
| Set the first string in the range. | |
| output_type | get () const |
| Get the current value. | |
| StringRange & | init () |
| Initialize an existing StringRange object. | |
| std::string | last () const noexcept |
| The current one past the last string in the range. | |
| StringRange & | last (std::string const &lst) |
| Set one past the last string in the range. | |
| StringRange & | max (size_type val) |
| Set one past the last string in the range by length. | |
| StringRange & | min (size_type val) |
| Set the first string in the range by length. | |
| void | next () noexcept |
| Advance to the next value. | |
| StringRange & | operator= (StringRange &&) |
| Default move assignment operator. | |
| StringRange & | operator= (StringRange const &) |
| Default copy assignment operator. | |
| Order | order () const noexcept |
| The current order of the strings in the range. | |
| StringRange & | order (Order val) |
| Set the order of the strings in the range. | |
| size_t | size_hint () const noexcept |
| The possible size of the range. | |
| size_type | upper_bound () const noexcept |
| The current upper bound on the length of a string in the range. | |
| StringRange & | upper_bound (size_type n) |
| Set an upper bound for the length of a string in the range. | |
|
inline |
Constructs an empty range with:
0;0;0;
|
inlinenodiscardnoexcept |
Returns the current alphabet in a StringRange object.
| StringRange & alphabet | ( | std::string const & | x | ) |
Sets the alphabet in a StringRange object.
| x | the alphabet. |
*this.| LibsemigroupsException | if x contains repeated letters. |
|
inlinenoexcept |
Returns true if a StringRange object is exhausted, and false if not.
bool.
|
inlinenoexcept |
This function returns an input iterator pointing to the first string in a StringRange object.
|
inlinenoexcept |
Returns the number of words in the range object. If order() is Order::shortlex, then size_hint() is used. If order() is not Order::shortlex, then a copy of the range may have to be looped over in order to find the return value of this function.
size_t.
|
inlinenoexcept |
This function returns an input iterator pointing one beyond the last string in a StringRange object.
|
inlinenodiscardnoexcept |
Returns the first string in a StringRange object.
|
inline |
Sets the first string in a StringRange object to be frst.
| frst | the first string. |
*this.frst contains letters not belonging to alphabet().
|
inline |
Returns the current string in a StringRange object.
true, then the return value of this function could be anything. | StringRange & init | ( | ) |
This function puts a StringRange object back into the same state as if it had been newly default constructed.
*this.
|
inlinenodiscardnoexcept |
Returns one past the last string in a StringRange object.
|
inline |
Sets one past the last string in a StringRange object to be lst.
| lst | one past the last string. |
*this.| LibsemigroupsException | if lst contains letters not belonging to alphabet(). |
|
inline |
Sets one past the last string in a StringRange object to be \(\alpha^n\) where \(\alpha\) is the first letter of alphabet() (or "a" if the alphabet is empty) and \(n\) corresponds to val.
| val | the exponent. |
*this.
|
inline |
Sets the first string in a StringRange object to be pow("a", val) (the string consisting of val letters equal to "a").
| val | the exponent. |
*this.
|
inlinenoexcept |
Advances a StringRange object to the next value (if any).
|
inlinenodiscardnoexcept |
Returns the current order of the strings in a StringRange object.
|
inline |
Sets the order of the strings in a StringRange object to val.
| val | the order. |
*this.| LibsemigroupsException | if val is not Order::shortlex or Order::lex. |
|
inlinenoexcept |
Returns the number of words in a StringRange object if order() is Order::shortlex. If order() is not Order::shortlex, then the return value of this function is meaningless.
size_t.
|
inlinenodiscardnoexcept |
Returns the current upper bound on the length of a string in a StringRange object. This setting is only used if order() is Order::lex.
|
inline |
Sets an upper bound for the length of a string in a StringRange object. This setting is only used if order() is Order::lex.
| n | the upper bound. |
*this.
|
staticconstexpr |
Value indicating that if get() is called twice on a StringRange object that is not changed between the two calls, then the return value of get() is the same both times.