22#ifndef LIBSEMIGROUPS_RANGES_HPP_
23#define LIBSEMIGROUPS_RANGES_HPP_
33#pragma GCC diagnostic push
34#pragma GCC diagnostic ignored "-Wshadow"
35#pragma GCC diagnostic ignored "-Winline"
36#if defined(__GNUC__) && !defined(__clang__)
37#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
39#include <rx/ranges.hpp>
40#pragma GCC diagnostic pop
44#include "detail/fmt.hpp"
45#include "detail/string.hpp"
121 template <
typename InputRange>
123 using output_type =
typename InputRange::output_type;
126 static constexpr bool is_finite = rx::is_finite_v<InputRange>;
128 static constexpr bool is_idempotent = rx::is_idempotent_v<InputRange>;
132 mutable output_type _val;
133 mutable bool _val_set;
135 explicit constexpr Range(InputRange&& input) noexcept
136 : _at_end(
false), _input(
std::move(input)), _val(), _val_set(
false) {}
138 [[nodiscard]] output_type get()
const noexcept;
140 constexpr void next()
noexcept {
144 [[nodiscard]]
constexpr bool at_end()
const noexcept {
148 [[nodiscard]]
constexpr size_t size_hint()
const noexcept {
157#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
158 template <
typename InputRange>
159 [[nodiscard]]
constexpr auto operator()(InputRange&& input)
const {
160 using Inner = rx::get_range_type_t<InputRange>;
190 template <
typename Range,
typename Compare>
210 template <
typename Range>
232 template <
typename Range1,
typename Range2>
253 template <
typename Range1,
typename Range2>
274 template <
typename Range1,
typename Range2>
301 template <
typename S,
typename T>
302 auto chain(S
const& x, T
const& y) {
303 return rx::chain(rx::iterator_range(x.cbegin(), x.cend()),
304 rx::iterator_range(y.cbegin(), y.cend()));
323 template <
typename T>
325 return rx::enumerate(rx::iterator_range(thing));
348 template <
typename Range,
349 typename = std::enable_if_t<rx::is_input_or_sink_v<Range>>>
std::ostringstream & operator<<(std::ostringstream &os, BMat8 const &x)
Insertion operator.
bool shortlex_compare(T const &first1, T const &last1, T const &first2, T const &last2)
Compare two objects of the same type using the short-lex reduction ordering.
Definition order.hpp:267
bool lexicographical_compare(T const &x, T const &y)
Compare two objects of the same type using std::lexicographical_compare.
Definition order.hpp:96
bool is_sorted(Range r, Compare &&comp)
Check if a range is sorted according to comp.
auto enumerate(T const &thing)
Enumerate an object (by const reference).
Definition ranges.hpp:324
auto chain(S const &x, T const &y)
Chain objects (const references).
Definition ranges.hpp:302
bool equal(Range1 r1, Range2 r2)
Check two ranges for equality.
Namespace for everything in the libsemigroups library.
Definition action.hpp:44
Random & operator=(Random const &)=default
Default copy assignment operator.
Random()=default
Default constructor.
Random(Random &&)=default
Default move constructor.
Random & operator=(Random &&)=default
Default move assignment operator.
Random(Random const &)=default
Default copy constructor.