2 #ifndef SYDEVS_RANGE_H_
3 #define SYDEVS_RANGE_H_
92 , stop_limit_(
std::numeric_limits<
int64>::max())
101 : start_limit_(start_limit)
102 , stop_limit_(stop_limit)
112 return start_limit_ + (after_ ? 2*
int64(stride_ > 0) - 1 : 0);
118 return stop_limit_ + (before_ ? 2*
int64(stride_ < 0) - 1 : 0);
130 return range(limit, stop_limit_, stride_,
false, before_);
136 return range(limit, stop_limit_, stride_,
true, before_);
142 return range(start_limit_, limit, stride_, after_,
false);
148 return range(start_limit_, limit, stride_, after_,
true);
154 return range(start_limit_,
155 (stride_ > 0 &&
stride < 0 && stop_limit_ == std::numeric_limits<int64>::max()) ? std::numeric_limits<int64>::min() :
156 (stride_ < 0 && stride > 0 && stop_limit_ == std::numeric_limits<int64>::min()) ? std::numeric_limits<int64>::max() :
A data type which represents a range of array indices along a single dimension.
Definition: range.h:51
range & operator=(range &&)=default
Move assignment.
constexpr range()
Constructs a range object representing a sequence that starts at 0 and increases by 1.
Definition: range.h:90
range & operator=(const range &)=default
Copy assignment.
constexpr range stop_at(int64 limit) const
Returns a new range object stopping at limit.
Definition: range.h:140
constexpr int64 stop() const
Returns the last possible index in the sequence.
Definition: range.h:116
constexpr range stride_by(int64 stride) const
Returns a new range object incremending by stride.
Definition: range.h:152
constexpr range start_at(int64 limit) const
Returns a new range object starting at limit.
Definition: range.h:128
constexpr range(const range &)=default
Copy constructor.
~range()=default
Destructor.
constexpr range stop_before(int64 limit) const
Returns a new range object stopping immediate before limit.
Definition: range.h:146
constexpr int64 start() const
Returns the first index in the sequence.
Definition: range.h:110
range(range &&)=default
Move constructor.
constexpr int64 stride() const
Returns the increment between sequence indices.
Definition: range.h:122
constexpr range start_after(int64 limit) const
Returns a new range object starting immediate after limit.
Definition: range.h:134
Definition: arraynd.h:1211
int64_t int64
Definition: number_types.h:15