Closed jpasqua closed 2 years ago
I see a problem in inlcuding your changes: you are introducing a dependency on std
library, which is not always available and also increases the library footprint, which is a problem with microcontrollers with very limited memory, like the Attiny or the ATMega328. Can you tell how much is the footprint growing?
If I get your point, you are still happy to store the elements by value using their pointers, but you wish to allow the write operations to work differently, depending on your necessity.
In my opinione this would be best achieved by decorating or extending the CircularBuffer rather than modifying it. If you contribute your feature in the form of a derived class or a decorating wrapper, users will not have to pay for the additional program space used unless they need to....
What do you think about this?
I apologize for the late reply - somehow I missed the notification. Good point about the dependency on std, though I believe using std::conditional and std::is_fundamental are compile-time only so should not increase the footprint. I will check.
Your suggestion is probably best. For other reasons I have since created a simplified Circular Buffer class that meets my needs a little better. I'll close this issue to get it off your radar.
Again, thanks for all the work you put into this.
First of all, thank you for this library. It has been very useful.
I have a fork which allows the user (or the compiler) to choose whether to pass elements to
push()
andunshift()
by value or reference. The choice is controlled by a #define:The functions then look like this:
I have also added a
peekAt()
:Not very useful for fundamental types, but can be useful for larger objects.
I'm happy to pass along the source or create a pull request if you're interested.