31#ifndef ETL_CYCLIC_VALUE_INCLUDED
32#define ETL_CYCLIC_VALUE_INCLUDED
39#include "static_assert.h"
41#include "static_assert.h"
52 template <
typename T, T FIRST = 0, T LAST = 0,
bool EtlRuntimeSpecialisation = ((FIRST == 0) && (LAST == 0))>
63 template <
typename T, T FIRST, T LAST>
147 for (
int i = 0;
i <
n; ++
i)
154 for (
int i = 0;
i < -
n; ++
i)
174 operator const T()
const
184 if (value >=
LAST) ETL_UNLIKELY
213 if (value <=
FIRST) ETL_UNLIKELY
249 template <const T FIRST2, const T LAST2>
285 using ETL_OR_STD::swap;
303 return lhs.value ==
rhs.value;
327 template <
typename T, T FIRST, T LAST>
375 : value(
other.value),
376 first_value(
other.first_value),
377 last_value(
other.last_value)
404 else if (
value_ < first_value)
436 for (
int i = 0;
i <
n; ++
i)
443 for (
int i = 0;
i < -
n; ++
i)
463 operator const T()
const
473 if (value >= last_value)
502 if (value <= first_value)
541 first_value =
other.first_value;
542 last_value =
other.last_value;
575 using ETL_OR_STD::swap;
595 return (
lhs.value ==
rhs.value) &&
596 (
lhs.first_value ==
rhs.first_value) &&
597 (
lhs.last_value ==
rhs.last_value);
Provides a value that cycles between two limits.
Definition cyclic_value.h:53
A templated set implementation that uses a fixed size buffer.
Definition set.h:2502
T first() const
Gets the first value.
Definition cyclic_value.h:557
void advance(int n)
Definition cyclic_value.h:143
const T last() const
Gets the last value.
Definition cyclic_value.h:275
cyclic_value(T first_, T last_)
Definition cyclic_value.h:350
cyclic_value(T first_, T last_, T initial)
Definition cyclic_value.h:364
T get() const
Gets the value.
Definition cyclic_value.h:259
T last() const
Gets the last value.
Definition cyclic_value.h:565
cyclic_value(T initial)
Definition cyclic_value.h:82
void set(T value_)
Definition cyclic_value.h:109
void to_first()
Resets the value to the first in the range.
Definition cyclic_value.h:415
cyclic_value()
Definition cyclic_value.h:72
T get() const
Gets the value.
Definition cyclic_value.h:549
void to_last()
Resets the value to the last in the range.
Definition cyclic_value.h:423
void swap(cyclic_value< T, FIRST, LAST > &other)
Swaps the values.
Definition cyclic_value.h:573
cyclic_value(const cyclic_value &other)
Copy constructor.
Definition cyclic_value.h:374
cyclic_value()
Definition cyclic_value.h:337
void advance(int n)
Definition cyclic_value.h:432
const T first() const
Gets the first value.
Definition cyclic_value.h:267
friend void swap(cyclic_value< T, FIRST, LAST > &lhs, cyclic_value< T, FIRST, LAST > &rhs)
Swaps the values.
Definition cyclic_value.h:293
cyclic_value(const cyclic_value< T, FIRST, LAST > &other)
Copy constructor.
Definition cyclic_value.h:90
void set(T value_)
Definition cyclic_value.h:398
void set(T first_, T last_)
Definition cyclic_value.h:387
void swap(cyclic_value< T, FIRST, LAST > &other)
Swaps the values.
Definition cyclic_value.h:283
void to_first()
Resets the value to the first in the range.
Definition cyclic_value.h:126
void to_last()
Resets the value to the last in the range.
Definition cyclic_value.h:134
bitset_ext
Definition absolute.h:38
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:645
void swap(etl::array< T, SIZE > &lhs, etl::array< T, SIZE > &rhs)
Template deduction guides.
Definition array.h:621
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:633
pair holds two objects of arbitrary type
Definition utility.h:164