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.
- Note
- There is a small overhead to using a StringRange object rather than using cbegin_wislo or cbegin_wilo directly.
The order and range of the words in a StringRange instance can be set using the member functions:
- Example
StringRange & min(size_type val)
Set the first string in the range by length.
Definition word-range.hpp:1886
StringRange & max(size_type val)
Set one past the last string in the range by length.
Definition word-range.hpp:1909
StringRange & alphabet(std::string const &x)
Set the alphabet.
StringRange & order(Order val)
Set the order of the strings in the range.
Definition word-range.hpp:1827
StringRange()
Default constructor.
Definition word-range.hpp:1696
@ shortlex
Definition order.hpp:54
- See also
- WordRange
|
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.
|
|
◆ StringRange()
Constructs an empty range with:
◆ alphabet() [1/2]
Returns the current alphabet in a StringRange object.
- Returns
- A value of type string.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
◆ alphabet() [2/2]
Sets the alphabet in a StringRange object.
- Parameters
-
- Returns
- A reference to
*this
.
- Exceptions
-
◆ at_end()
Returns true
if a StringRange object is exhausted, and false
if not.
- Returns
- A value of type
bool
.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
◆ begin()
This function returns an input iterator pointing to the first string in a StringRange object.
- Returns
- An input iterator.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
- Note
- The return type of end might be different from the return type of begin.
- See also
- end.
◆ count()
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.
- Returns
- A value of type
size_t
.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
◆ end()
This function returns an input iterator pointing one beyond the last string in a StringRange object.
- Returns
- An input iterator.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
- Note
- The return type of end might be different from the return type of begin.
- See also
- begin.
◆ first() [1/2]
Returns the first string in a StringRange object.
- Returns
- A string by value.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
- See also
- min
◆ first() [2/2]
Sets the first string in a StringRange object to be frst
.
- Parameters
-
- Returns
- A reference to
*this
.
- Note
- Unlike WordRange::first, this function will throw if
frst
contains letters not belonging to alphabet().
- See also
- min
◆ get()
Returns the current string in a StringRange object.
- Returns
- A value of type output_type.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
- Warning
- If at_end() returns
true
, then the return value of this function could be anything.
◆ init()
This function puts a StringRange object back into the same state as if it had been newly default constructed.
- Returns
- A reference to
*this
.
- Exceptions
- This function guarantees not to throw a LibsemigroupsException.
◆ last() [1/2]
Returns one past the last string in a StringRange object.
- Returns
- A string by value.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
- See also
- max
◆ last() [2/2]
Sets one past the last string in a StringRange object to be lst
.
- Parameters
-
lst | one past the last string. |
- Returns
- A reference to
*this
.
- Exceptions
-
- Note
- The behaviour of this function is not exactly the same as
WordRange::last(word_type const&)
. That function will not throw if a word contains letters not in the alphabet.
- See also
- max
◆ max()
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
.
- Parameters
-
- Returns
- A reference to
*this
.
- Exceptions
- This function guarantees not to throw a LibsemigroupsException.
◆ min()
Sets the first string in a StringRange object to be pow("a", val)
(the string consisting of val
letters equal to "a"
).
- Parameters
-
- Returns
- A reference to
*this
.
- Exceptions
- This function guarantees not to throw a LibsemigroupsException.
◆ next()
Advances a StringRange object to the next value (if any).
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
- See also
- at_end
◆ order() [1/2]
Returns the current order of the strings in a StringRange object.
- Returns
- A value of type Order.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
◆ order() [2/2]
Sets the order of the strings in a StringRange object to val
.
- Parameters
-
- Returns
- A reference to
*this
.
- Exceptions
-
◆ size_hint()
size_t size_hint |
( |
| ) |
const |
|
inlinenoexcept |
◆ upper_bound() [1/2]
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.
- Returns
- A value of type size_type.
- Exceptions
- This function is
noexcept
and is guaranteed never to throw.
◆ upper_bound() [2/2]
◆ is_idempotent
bool is_idempotent = true |
|
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.
The documentation for this class was generated from the following file: