From a985a728401af73daadd5d9bd4541ffedcb1b5d7 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 23 Sep 2017 09:50:04 +0100 Subject: [PATCH] Allow type to be floating point by changing the comparison operators from == to >= and <= --- src/cyclic_value.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cyclic_value.h b/src/cyclic_value.h index e5f5e07a..cb3a37c0 100644 --- a/src/cyclic_value.h +++ b/src/cyclic_value.h @@ -59,8 +59,6 @@ namespace etl { public: - STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - template friend class cyclic_value; //************************************************************************* @@ -166,7 +164,7 @@ namespace etl //************************************************************************* cyclic_value& operator ++() { - if (value == last_value) + if (value >= last_value) { value = first_value; } @@ -195,7 +193,7 @@ namespace etl //************************************************************************* cyclic_value& operator --() { - if (value == first_value) + if (value <= first_value) { value = last_value; }