protocol/RangeArg: add static method OpenEnded()

This commit is contained in:
Max Kellermann
2021-02-15 19:55:55 +01:00
parent 103194e32d
commit 6e1940e930
2 changed files with 9 additions and 2 deletions

View File

@@ -25,8 +25,15 @@
struct RangeArg {
unsigned start, end;
/**
* Construct an open-ended range starting at the given index.
*/
static constexpr RangeArg OpenEnded(unsigned start) noexcept {
return { start, std::numeric_limits<unsigned>::max() };
}
static constexpr RangeArg All() noexcept {
return { 0, std::numeric_limits<unsigned>::max() };
return OpenEnded(0);
}
constexpr bool operator==(RangeArg other) const noexcept {