protocol/RangeArg: add static method Single()

This commit is contained in:
Max Kellermann
2021-02-15 19:44:20 +01:00
parent ad059d5804
commit b57eeaa720
2 changed files with 8 additions and 1 deletions

View File

@@ -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;
}