16 #include <type_traits> 69 static_assert(std::is_integral<T>::value,
"Only integral types are supported.");
78 TSeq(
T theEnd): fBegin(), fEnd(theEnd), fStep(1) {
81 TSeq(
T theBegin,
T theEnd,
T theStep = 1):
82 fBegin(theBegin), fEnd(theEnd), fStep(theStep) {
86 class iterator:
public std::iterator<std::random_access_iterator_tag, T, difference_type> {
105 return iterator(fCounter + v * fStep, fStep);
109 return iterator(fCounter - v * fStep, fStep);
146 return (other - *
this) > 0;
149 return other < *
this;
152 return !(*
this > other);
155 return !(other > *
this);
167 auto isStepMultiple = (fEnd -
fBegin) % fStep == 0;
168 auto theEnd = isStepMultiple ?
fEnd : fStep * (((fEnd -
fBegin) / fStep) + 1) + fBegin;
177 return s * fStep +
fBegin;
222 std::ostringstream ret;
223 ret <<
"A sequence of values: " << *val->
begin()
224 <<
" <= i < " << *val->
end();
227 ret <<
" in steps of " <<
step;
iterator & operator-=(const difference_type &v)
bool operator>(const iterator &other) const
typename std::make_signed< T >::type difference_type
Namespace for new ROOT classes and functions.
bool operator>=(const iterator &other) const
iterator operator+(difference_type v) const
bool operator<(const iterator &other) const
std::string printValue(ROOT::TSeq< T > *val)
bool operator<=(const iterator &other) const
TSeq(T theBegin, T theEnd, T theStep=1)
iterator(T start, T step)
bool operator!=(const iterator &other) const
iterator operator-(difference_type v) const
A pseudo container class which is a generator of indices.
Print a TSeq at the prompt:
static constexpr double s
bool operator==(const iterator &other) const
iterator & operator+=(const difference_type &v)
const T operator[](const difference_type &v) const
difference_type operator-(const iterator &other) const