protocol/RangeArg: add static method Single()
This commit is contained in:
parent
ad059d5804
commit
b57eeaa720
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user