16 static constexpr
char s_rangeSeparator =
':';
25 interval.
lower.reset();
26 interval.
upper.reset();
29 auto pos = buf.find_first_of(s_rangeSeparator);
31 if (
pos == std::string::npos) {
37 auto lowerStr = buf.substr(0,
pos);
38 interval.
lower = std::atof(lowerStr.c_str());
41 if ((
pos + 1) < buf.size()) {
42 auto upperStr = buf.substr(
pos + 1);
43 interval.
upper = std::atof(upperStr.c_str());
51 if (not interval.
lower.has_value() and not interval.
upper.has_value()) {
54 if (interval.
lower.has_value()) {
55 os << interval.
lower.value();
57 os << s_rangeSeparator;
58 if (interval.
upper.has_value()) {
59 os << interval.
upper.value();
67 template <
typename Iterator>
68 inline std::ostream& printContainer(std::ostream& os, Iterator begin,
70 for (
auto it = begin;
it != end; ++
it) {
81 return printContainer(os, vec.begin(), vec.end(),
" ");
85 return printContainer(os, vec.begin(), vec.end(),
" ");
89 return printContainer(os, vec.begin(), vec.end(),
" ");