Strings in short-lex order (sislo)¶
The functions libsemigroups::cbegin_sislo()
and
libsemigroups::cend_sislo()
can be used to iterate through strings in
short-lex order in some range.
-
const_sislo_iterator libsemigroups::cbegin_sislo(std::string const &alphabet, std::string const &first, std::string const &last)¶
Returns a forward iterator pointing to the 2nd parameter
first
.If incremented, the iterator will point to the next least short-lex string after
w
overalphabet
. Iterators of the type returned by this function are equal whenever they are obtained by advancing the return value of any call tocbegin_sislo
by the same amount, or they are both obtained by any call tocend_sislo
.See also
- Example
std::vector<std::string>(cbegin_sislo("ba", "b", "bbb"), cend_sislo("ba", "b", "bbb")); // {"b", "b", "bb", "ba","ab", "aa"};
Warning
Copying iterators of this type is expensive. As a consequence, prefix incrementing
++it
the iteratorit
returned bycbegin_sislo
is significantly cheaper than postfix incrementingit++
.Warning
Iterators constructed using different parameters may not be equal, so best not to loop over them.
- Parameters
alphabet – the alphabet
first – the starting point for the iteration;
last – the ending point for the iteration.
- Throws
(None) – This function guarantees not to throw a
LibsemigroupsException
.- Returns
An iterator of type
const_sislo_iterator
.
-
const_sislo_iterator libsemigroups::cend_sislo(std::string const &alphabet, std::string const &first, std::string const &last)¶
Returns a forward iterator pointing to one after the end of the range from
first
tolast
.The iterator returned by this is still dereferenceable and incrementable, but does not point to a string in the correct range.
See also