ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.04k stars 371 forks source link

cyclic_value first/last methods #864

Closed Sn1cket closed 2 months ago

Sn1cket commented 3 months ago

Hello, I'm using the cyclic_value like this:

typedef etl::cyclic_value<uint8_t, 0, 23> Hours;

So my limits are known by compile time. Sometimes I have the need to access the first/last values of my type without defining a variable. Right now this isn't possible because the first/last methods are instance methods and I get this error from the compiler.

a nonstatic member reference must be relative to a specific object

Wouldn't it be a nice addition to the cyclic_value template variant that cannot change first/last during runtime, to make the first/last methods static const or even constexpr?

Best regards

jwellbelove commented 3 months ago

That sounds a good idea.

jwellbelove commented 2 months ago

Added 20.38.11