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"
122 template <
typename InputRange>
124 using output_type =
typename InputRange::output_type;
126 static constexpr bool is_finite = rx::is_finite_v<InputRange>;
127 static constexpr bool is_idempotent = rx::is_idempotent_v<InputRange>;
131 std::decay_t<output_type> _val;
134 explicit constexpr Range(InputRange&& input) noexcept
135 : _at_end(
false), _input(
std::move(input)), _val(), _val_set(
false) {}
137 explicit constexpr Range(InputRange
const& input) noexcept
138 : _at_end(
false), _input(input), _val(), _val_set(
false) {}
140 [[nodiscard]] output_type get()
noexcept;
142 constexpr void next()
noexcept {
146 [[nodiscard]]
constexpr bool at_end()
const noexcept {
150 [[nodiscard]]
constexpr size_t size_hint()
const noexcept {
159#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
160 template <
typename InputRange>
161 [[nodiscard]]
constexpr auto operator()(InputRange&& input)
const {
162 using Inner = rx::get_range_type_t<InputRange>;
192 template <
typename Range,
typename Compare>
212 template <
typename Range>
234 template <
typename Range1,
typename Range2>
255 template <
typename Range1,
typename Range2>
276 template <
typename Range1,
typename Range2>
303 template <
typename S,
typename T>
304 auto chain(S
const& x, T
const& y) {
305 return rx::chain(rx::iterator_range(x.cbegin(), x.cend()),
306 rx::iterator_range(y.cbegin(), y.cend()));
325 template <
typename T>
327 return rx::enumerate(rx::iterator_range(thing));
350 template <
typename Range,
351 typename = std::enable_if_t<rx::is_input_or_sink_v<Range>>>
std::ostringstream & operator<<(std::ostringstream &os, BMat8 const &x)
Insertion operator.
bool lexicographical_compare(Thing const &x, Thing const &y)
Compare two objects of the same type using std::lexicographical_compare.
Definition order.hpp:112
bool shortlex_compare(Iterator first1, Iterator last1, Iterator first2, Iterator last2)
Compare two objects of the same type using the short-lex reduction ordering.
Definition order.hpp:288
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:326
auto chain(S const &x, T const &y)
Chain objects (const references).
Definition ranges.hpp:304
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.