The following code gives wrong results when the line to parse is assigned to a deque (code)
#include <scn/scan.h>
#include <scn/ranges.h>
#include <deque>
#include <iostream>
#include <string_view>
int main() {
std::string_view line("123456,654321");
std::deque<char> dq;
dq.assign(line.begin(), line.end());
scn::ranges::subrange range(dq.begin(), dq.end());
auto result = scn::scan<int, int>(range, "{},{}");
if(result) {
auto [v0, v1] = result->values();
std::cout << "Result: " << v0 << ", " << v1 << "\n";
} else {
std::cout << "Failed: " << result.error().msg() << "\n";
}
}
Which prints Result: 123456, 6. Adding a space after the comma in both the format string and input line yields the expected result. I guess that takes a different code path. I've also hit many cases of parsing result being EOF or "Argument list not exhausted", but these are seemingly random and I haven't found a consistent way to reproduce them.
The following code gives wrong results when the line to parse is assigned to a deque (code)
Which prints
Result: 123456, 6. Adding a space after the comma in both the format string and input line yields the expected result. I guess that takes a different code path. I've also hit many cases of parsing result being EOF or "Argument list not exhausted", but these are seemingly random and I haven't found a consistent way to reproduce them.