ETLCPP / etl

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

Change push to push_back on containers, so they can be used with std::back_inserter #841

Closed DavidWild02 closed 2 months ago

DavidWild02 commented 4 months ago

this code: std::copy_n(reinterpret_cast<const std::byte *>(&data), std::back_inserter(binaryBuffer)); does not work, because the etl::circular_buffer has no member push_back(__value).

It would be nice implementing this. So that the container can be used with functions of the standard library.

jwellbelove commented 4 months ago

The ETL tries to adhere to STL API conventions to maintain compatibility as much as possible, and so ETL containers like queues and stacks use push() and not push_back(). As etl::circular_buffer is essentially a queue it has a push().

A better alternative may be to create an etl::push_inserter() that calls the container's push().

jwellbelove commented 2 months ago

Resolved 20.38.11