Header lexy/input/range_input.hpp
Input lexy::range_input
lexy/input/range_input.hpp
namespace lexy
{
template <encoding Encoding,
typename Iterator, typename Sentinel = Iterator>
class range_input
requires std::forward_iterator<Iterator>
&& std::sentinel_for<Sentinel, Iterator>
{
public:
using encoding = Encoding;
using char_type = typename encoding::char_type;
using iterator = Iterator;
using sentinel = Sentinel;
//=== constructors ===//
constexpr range_input() noexcept;
constexpr range_input(iterator begin, sentinel end) noexcept;
//=== access ===//
constexpr iterator begin() const noexcept;
constexpr iterator end() const noexcept;
constexpr reader auto reader() const& noexcept;
};
template <typename Iterator, typename Sentinel>
range_input(Iterator begin, Sentinel end)
-> range_input<deduce-encoding, Iterator, Sentinel>;
}
The class range_input
uses the forward range [begin, end)
as input.
It is a lightweight view and does not own any data. If no template arguments are specified, CTAD is used to deduce the encoding from the value type of the iterator.
Example 1. Use a
std::list
as inputTip | If the iterators are pointers, use lexy::string_input instead. |
Tip | If you’re parsing a subset of an input, use lexy::lexeme_input instead. |