This commit is contained in:
2024-09-15 01:25:58 +03:00
parent a7626bfe5e
commit d33c101d70
5 changed files with 95 additions and 48 deletions

View File

@@ -34,6 +34,10 @@ struct AdcStopSeqSessionProto {
static_assert(STOP_SEQ_SIZE, "STOP BYTE SEQUENCE MUST NOT BE AN EMPTY ONE!!!");
typedef std::string proto_ident_t;
proto_ident_t ident() const { return "STOP SEQUENCE PROTO"; }
template <traits::adc_input_char_range R>
auto search(const R& r)
{
@@ -41,7 +45,7 @@ struct AdcStopSeqSessionProto {
std::get<1>(res) = std::search(r.begin(), r.end(), STOP_SEQ.begin(), STOP_SEQ.end());
if (std::get<1>(res) != r.end()) { // move iterator to the one-past-the-end position
std::get<1>(res) = std::advance(std::get<1>(res), STOP_SEQ_SIZE);
std::advance(std::get<1>(res), STOP_SEQ_SIZE);
std::get<2>(res) = true;
}
@@ -73,7 +77,8 @@ struct AdcStopSeqSessionProto {
auto N = std::distance(r.begin(), r.end());
if (N < STOP_SEQ_SIZE) { // one must ensure for input range size correctness
return std::span<std::ranges::range_value_t<R>>();
// return std::span<std::ranges::range_value_t<R>>();
return std::ranges::subrange(r.begin(), r.begin());
}
if constexpr (std::ranges::viewable_range<R>) {