This page contains links to some classes and functions in libsemigroups that extend the functionality of range objects from rx::ranges.
Please consult the rx::ranges README file for more information about ranges in general and the existing functionality of rx::ranges.
Range objects are used extensively elsewhere in libsemigroups, and are returned by many functions.
Classes | |
| struct | Random |
| Aggregator for choosing a single random item in a range. More... | |
Functions | |
| template<typename S, typename T> | |
| auto | chain (S const &x, T const &y) |
| Chain objects (const references). | |
| template<typename T> | |
| auto | enumerate (T const &thing) |
| Enumerate an object (by const reference). | |
| template<typename Range1, typename Range2> | |
| bool | equal (Range1 r1, Range2 r2) |
| Check two ranges for equality. | |
| template<typename Range> | |
| bool | is_sorted (Range r) |
| Check if a range is sorted according to std::less. | |
| template<typename Range, typename Compare> | |
| bool | is_sorted (Range r, Compare &&comp) |
Check if a range is sorted according to comp. | |
| template<typename Range1, typename Range2> | |
| bool | lexicographical_compare (Range1 r1, Range2 r2) |
| Check if a range is lexicographically less than another. | |
| template<typename Range, typename = std::enable_if_t<rx::is_input_or_sink_v<Range>>> | |
| std::ostream & | operator<< (std::ostream &os, Range r) |
| Insert a range into an output stream. | |
| template<typename Range1, typename Range2> | |
| bool | shortlex_compare (Range1 r1, Range2 r2) |
| Check if a range is shortlex less than another. | |
| auto chain | ( | S const & | x, |
| T const & | y ) |
Defined in ranges.hpp.
This function is just a wrapper for rx::chain but taking objects by reference rather than using iterators for convenience, and it returns a range objects where the items in x come before any of the items in y.
| S | the type of the first argument. |
| T | the type of the second argument. |
| x | the first object to chain. |
| y | the second object to chain. |
| auto enumerate | ( | T const & | thing | ) |
Defined in ranges.hpp.
This function is just a wrapper for rx::enumerate but taking objects by reference rather than using iterators for convenience, and it returns a a pair consisting of the index of an item and that item. This is similar to the function of the same name in python.
| T | the type of the argument. |
| thing | the object to enumerate. |
| bool equal | ( | Range1 | r1, |
| Range2 | r2 ) |
Defined in ranges.hpp.
This function checks if the ranges r1 and r2 are equal, in that they contain the same items (compared using operator==) in the same order. This is analogous to std::equal.
| Range1 | the type of the first range. |
| Range2 | the type of the second range. |
| r1 | the first range. |
| r2 | the second range. |
true if the ranges are equal and false if not. | bool is_sorted | ( | Range | r | ) |
Defined in ranges.hpp.
This function checks if a range is sorted according to the comparison function object comp, and is analogous to std::is_sorted.
| Range | the type of the range to check for sortedness. |
| r | the input range. |
true if the elements in the range are sorted in non-descending order according to std::less and false otherwise.true for ranges of size 0 and 1. | bool is_sorted | ( | Range | r, |
| Compare && | comp ) |
Defined in ranges.hpp.
This function checks if a range is sorted according to the comparison function object comp, and is analogous to std::is_sorted.
| Range | the type of the range to check for sortedness. |
| Compare | the type of the comparison function object. |
| r | the input range. |
| comp | the comparison function object which returns true if the first argument is less than the second. |
true if the elements in the range are sorted in non-descending order according to comp and false otherwise.true for ranges of size 0 and 1. | bool lexicographical_compare | ( | Range1 | r1, |
| Range2 | r2 ) |
Defined in ranges.hpp.
This function checks if the range r1 is lexicographically less than the range r2, using operator< on the items in the ranges. This is analogous to std::lexicographical_compare.
| Range1 | the type of the first range. |
| Range2 | the type of the second range. |
| r1 | the first range. |
| r2 | the second range. |
true if the range r1 is lexicographically less than the range r2, and false it not. | std::ostream & operator<< | ( | std::ostream & | os, |
| Range | r ) |
Defined in ranges.hpp.
This function inserts a human readable representation of a range object into a std::ostream by applying std::to_string to each item in the range.
| Range | the type of the range (must satisfy rx::is_input_or_sink_v<Range>). |
| os | the output stream. |
| r | the range object. |
os. | bool shortlex_compare | ( | Range1 | r1, |
| Range2 | r2 ) |
Defined in ranges.hpp.
This function checks if the range r1 is shortlex less than the range r2, using operator< on the items in the ranges. This is analogous to shortlex_compare.
| Range1 | the type of the first range. |
| Range2 | the type of the second range. |
| r1 | the first range. |
| r2 | the second range. |
true if the range r1 is shortlex less than the range r2, and false it not.