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

Method call

include/boost/parser/search.hpp:38–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 {
37 template<typename R>
38 static constexpr auto call(R && r)
39 {
40 static_assert(std::is_same_v<R, R_>);
41 using T = remove_cv_ref_t<R>;
42 if constexpr (std::is_same_v<sentinel_t<T>, null_sentinel_t>) {
43 auto plus_strlen = [](auto * ptr) {
44 while (*ptr) {
45 ++ptr;
46 }
47 return ptr;
48 };
49 auto const first = r.begin();
50 if constexpr (OtherRangeFormat == no_format) {
51 if constexpr (ToCommonRange) {
52 return BOOST_PARSER_SUBRANGE(
53 first, plus_strlen(first));
54 } else {
55 return (R &&) r;
56 }
57 } else {
58 if constexpr (ToCommonRange) {
59 return BOOST_PARSER_SUBRANGE(
60 first, plus_strlen(first)) |
61 as_utf<OtherRangeFormat>;
62 } else {
63 return (R &&) r | as_utf<OtherRangeFormat>;
64 }
65 }
66 } else if constexpr (text::detail::is_bounded_array_v<T>) {
67 auto const first = std::begin(r);
68 auto last = std::end(r);
69 constexpr auto n = std::extent_v<T>;
70 if (n && !r[n - 1])
71 --last;
72 if constexpr (OtherRangeFormat == no_format) {
73 return BOOST_PARSER_SUBRANGE(first, last);
74 } else {
75 return BOOST_PARSER_SUBRANGE(first, last) |
76 as_utf<OtherRangeFormat>;
77 }
78 } else {
79 return (R &&) r | as_utf<OtherRangeFormat>;
80 }
81 }
82 };
83
84 template<typename R_, bool ToCommonRange>

Callers

nothing calls this directly

Calls 3

beginFunction · 0.70
endFunction · 0.70
beginMethod · 0.45

Tested by

no test coverage detected