6#include <stratax/exceptions/Exceptions.hpp>
8namespace stratax::core {
97 return static_cast<size_type>((distance + step_ - 1) / step_);
107 return static_cast<size_type>((distance + stride - 1) / stride);
111 [[nodiscard]]
bool empty() const noexcept {
return size() == 0;}
119 [[nodiscard]]
bool operator==(
const Slice& other)
const noexcept {
return start_ == other.start_ && stop_ == other.stop_ && step_ == other.step_;}
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.