10namespace stratax::core {
98 return 1 + (distance - 1) / stride;
108 return 1 + (distance - 1) / stride;
112 [[nodiscard]]
bool empty() const noexcept {
return size() == 0;}
120 [[nodiscard]]
bool operator==(
const Slice& other)
const noexcept {
return start_ == other.start_ && stop_ == other.stop_ && step_ == other.step_;}
Stratax exception types derived from std::runtime_error.
Index or slice cannot be used for the requested access.
Describes a signed, strided half-open index range.
size_type size() const noexcept
Returns the number of indices described by the raw range.
difference_type start() const noexcept
Returns the raw inclusive start bound.
bool operator==(const Slice &other) const noexcept
Compares two slices by their stored bounds and step.
difference_type stop() const noexcept
Returns the raw exclusive stop bound.
std::size_t size_type
Unsigned type used for the number of selected indices.
Slice(difference_type start, difference_type stop, difference_type step=1)
Constructs a slice from raw half-open bounds and a step.
bool empty() const noexcept
Reports whether the raw range selects no indices.
difference_type step() const noexcept
Returns the nonzero signed step.
std::ptrdiff_t difference_type
Signed type used for bounds and step values.