Commit b57eeaa7 authored by Max Kellermann's avatar Max Kellermann

protocol/RangeArg: add static method Single()

parent ad059d58
......@@ -107,7 +107,7 @@ ParseCommandArgRange(const char *s)
range.end = (unsigned)value;
} else {
range.end = (unsigned)value + 1;
return RangeArg::Single(range.start);
}
return range;
......
......@@ -36,6 +36,13 @@ struct RangeArg {
return OpenEnded(0);
}
/**
* Construct an instance describing exactly one index.
*/
static constexpr RangeArg Single(unsigned i) noexcept {
return { i, i + 1 };
}
constexpr bool operator==(RangeArg other) const noexcept {
return start == other.start && end == other.end;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment