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>
148 for (
int i = 0;
i <
n; ++
i)
155 for (
int i = 0;
i < -
n; ++
i)
175 operator const T()
const
185 if (value >=
Last) ETL_UNLIKELY
214 if (value <=
First) ETL_UNLIKELY
250 template <const T FIRST2, const T LAST2>
286 using ETL_OR_STD::swap;
304 return lhs.value ==
rhs.value;
328 template <
typename T, T First, T Last>
377 , first_value(
other.first_value)
378 , last_value(
other.last_value)
405 else if (
value_ < first_value)
437 for (
int i = 0;
i <
n; ++
i)
444 for (
int i = 0;
i < -
n; ++
i)
464 operator const T()
const
474 if (value >= last_value)
503 if (value <= first_value)
542 first_value =
other.first_value;
543 last_value =
other.last_value;
576 using ETL_OR_STD::swap;
596 return (
lhs.value ==
rhs.value) &&
597 (
lhs.first_value ==
rhs.first_value) &&
598 (
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:2548
void swap(cyclic_value< T, First, Last > &other)
Swaps the values.
Definition cyclic_value.h:284
cyclic_value(T first_, T last_)
Definition cyclic_value.h:351
void to_first()
Resets the value to the first in the range.
Definition cyclic_value.h:416
friend void swap(cyclic_value< T, First, Last > &lhs, cyclic_value< T, First, Last > &rhs)
Swaps the values.
Definition cyclic_value.h:294
cyclic_value(const cyclic_value< T, First, Last > &other)
Copy constructor.
Definition cyclic_value.h:90
T last() const
Gets the last value.
Definition cyclic_value.h:566
void advance(int n)
Definition cyclic_value.h:433
void set(T value_)
Definition cyclic_value.h:110
void advance(int n)
Definition cyclic_value.h:144
void set(T first_, T last_)
Definition cyclic_value.h:388
void swap(cyclic_value< T, First, Last > &other)
Swaps the values.
Definition cyclic_value.h:574
cyclic_value(T initial)
Definition cyclic_value.h:82
static ETL_CONSTEXPR T last()
Gets the last value.
Definition cyclic_value.h:276
cyclic_value(const cyclic_value &other)
Copy constructor.
Definition cyclic_value.h:375
T get() const
Gets the value.
Definition cyclic_value.h:550
T first() const
Gets the first value.
Definition cyclic_value.h:558
cyclic_value(T first_, T last_, T initial)
Definition cyclic_value.h:365
static ETL_CONSTEXPR T first()
Gets the first value.
Definition cyclic_value.h:268
cyclic_value()
Definition cyclic_value.h:338
void to_last()
Resets the value to the last in the range.
Definition cyclic_value.h:135
void to_first()
Resets the value to the first in the range.
Definition cyclic_value.h:127
void to_last()
Resets the value to the last in the range.
Definition cyclic_value.h:424
T get() const
Gets the value.
Definition cyclic_value.h:260
void set(T value_)
Definition cyclic_value.h:399
cyclic_value()
Definition cyclic_value.h:72
bitset_ext
Definition absolute.h:38
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:654
void swap(etl::array< T, SIZE > &lhs, etl::array< T, SIZE > &rhs)
Template deduction guides.
Definition array.h:630
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:642
pair holds two objects of arbitrary type
Definition utility.h:164