42 :
Slice(0,
std::numeric_limits<int>::max(), 1) {}
50 this->stop = (
start == -1) ? std::numeric_limits<int>::max() :
start + 1;
58 template <
typename Start,
typename Stop>
59 requires(std::same_as<Start, slicing::none_t> ||
60 std::convertible_to<Start, int>) &&
61 (std::same_as<Stop, slicing::none_t> ||
62 std::convertible_to<Stop, int>)
71 template <
typename Start,
typename Stop,
typename Step>
72 requires(std::same_as<Start, slicing::none_t> ||
73 std::convertible_to<Start, int>) &&
74 (std::same_as<Stop, slicing::none_t> ||
75 std::convertible_to<Stop, int>) &&
76 (std::same_as<Step, slicing::none_t> ||
77 std::convertible_to<Step, int>)
79 if constexpr (std::same_as<Step, slicing::none_t>) {
88 if (this->step == std::numeric_limits<int>::min()) {
89 this->step = -std::numeric_limits<int>::max();
92 if constexpr (std::same_as<Start, slicing::none_t>) {
94 this->start = std::numeric_limits<int>::max();
102 if constexpr (std::same_as<Stop, slicing::none_t>) {
103 if (this->step < 0) {
104 this->stop = std::numeric_limits<int>::min();
106 this->stop = std::numeric_limits<int>::max();
128 }
else if (
start >= length) {
129 start = (
step < 0) ? length - 1 : length;
138 }
else if (
stop >= length) {
139 stop = (
step < 0) ? length - 1 : length;
#define slp_assert(condition)
Abort in C++.
Definition assert.hpp:25
int step
Step.
Definition slice.hpp:34
constexpr Slice()=default
Constructs a Slice.
int stop
Stop index (exclusive).
Definition slice.hpp:31
constexpr Slice(Start start, Stop stop)
Constructs a slice.
Definition slice.hpp:63
constexpr Slice(slicing::none_t)
Constructs a slice.
Definition slice.hpp:41
constexpr int adjust(int length)
Adjusts start and end slice indices assuming a sequence of the specified length.
Definition slice.hpp:118
int start
Start index (inclusive).
Definition slice.hpp:28
constexpr Slice(Start start, Stop stop, Step step)
Constructs a slice.
Definition slice.hpp:78
constexpr Slice(int start)
Constructs a slice.
Definition slice.hpp:48
static constexpr none_t _
Designates an omitted argument of the slice.
Definition slice.hpp:20
Definition expression_graph.hpp:11
Definition StringMap.hpp:773
Type tag used to designate an omitted argument of the slice.
Definition slice.hpp:17
#define SLEIPNIR_DLLEXPORT
Definition symbol_exports.hpp:34