Our interval template started life as `range`, and was supported wrapping to follow Cassandra's convention of wrapping around the maximum token. We later recognized that an interval type should usually be non-wrapping and split it into wrapping_range and nonwrapping_range, with `range` aliasing wrapping_range to preserve compatibility. Even later, we realized the name was already taken by C++ ranges and so renamed it to `interval`. Given that intervals are usually non-wrapping, the default `interval` type is non-wrapping. We can now simplify it further, recognizing that everyone assumes that an interval is non-wrapping and so doesn't need the nonwrapping_interval_designation. We just rename nonwrapping_interval to `interval` and remove the type alias.
28 lines
505 B
C++
28 lines
505 B
C++
/*
|
|
* Copyright 2016-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
template<typename T>
|
|
class interval_bound {
|
|
T value();
|
|
bool is_inclusive();
|
|
};
|
|
|
|
template<typename T>
|
|
class wrapping_interval {
|
|
std::optional<interval_bound<T>> start();
|
|
std::optional<interval_bound<T>> end();
|
|
bool is_singular();
|
|
};
|
|
|
|
template<typename T>
|
|
class interval {
|
|
std::optional<interval_bound<T>> start();
|
|
std::optional<interval_bound<T>> end();
|
|
bool is_singular();
|
|
};
|