1#ifndef CHITECH_CHI_MATH_RANGE_H
2#define CHITECH_CHI_MATH_RANGE_H
17template<
typename T,
typename D =
int>
18std::vector<T>
Range(T start, T end, D delta=1)
20 static_assert(std::is_signed<D>::value,
21 "chi_math::Range delta parameter must be signed");
22 const bool forward = (delta > 0);
24 std::vector<T> sequence = {};
26 if ( forward and start >= end)
return sequence;
27 if (not forward and start <= end)
return sequence;
30 bool terminate =
false;
33 sequence.push_back(i);
36 if ( forward and i >= end) terminate =
true;
37 if (not forward and i <= end) terminate =
true;
39 if (not forward and i > start) terminate =
true;
std::vector< T > Range(T start, T end, D delta=1)