MCPcopy Create free account
hub / github.com/boostorg/parser / subrange

Class subrange

include/boost/parser/subrange.hpp:24–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 template<typename I, typename S = I>
23#endif
24 struct subrange : detail::stl_interfaces::view_interface<subrange<I, S>>
25 {
26 constexpr subrange() = default;
27 constexpr subrange(I first, S last) : first_(first), last_(last) {}
28 template<typename R>
29 constexpr explicit subrange(R const & r) :
30 first_(detail::text::detail::begin(r)),
31 last_(detail::text::detail::end(r))
32 {}
33
34 constexpr I begin() const { return first_; }
35 constexpr S end() const { return last_; }
36
37 [[nodiscard]] constexpr subrange next(std::ptrdiff_t n = 1) const
38 {
39 return subrange{detail::text::detail::next(first_), last_};
40 }
41 [[nodiscard]] constexpr subrange prev(std::ptrdiff_t n = 1) const
42 {
43 return subrange{detail::text::detail::prev(first_), last_};
44 }
45
46 constexpr subrange & advance(std::ptrdiff_t n)
47 {
48 std::advance(first_, n);
49 return *this;
50 }
51
52 template<
53 typename I2,
54 typename S2,
55 typename Enable = std::enable_if_t<
56 std::is_convertible<I, I2>::value &&
57 std::is_convertible<S, S2>::value>>
58 constexpr operator subrange<I2, S2>() const
59 {
60 return {first_, last_};
61 }
62
63 private:
64 I first_;
65 [[no_unique_address]] S last_;
66 };
67
68#if defined(__cpp_deduction_guides)
69#if BOOST_PARSER_USE_CONCEPTS

Callers

nothing calls this directly

Calls 1

advanceFunction · 0.85

Tested by

no test coverage detected