Opened 9 years ago

Last modified 5 years ago

#9299 new Feature Requests

Feature Requests: circular_buffer::emplace(...)

Reported by: anonymous Owned by: No-Maintainer
Milestone: To Be Determined Component: circular_buffer
Version: Boost Development Trunk Severity: Not Applicable
Keywords: circular_buffer emplace c++11 Cc:

Description

I think a great addition to circular_buffer would be to support emplace(...)/emplace_back()/emplace_front() to make it more C++11 compliant.

At the first quick glance I took at the source, implementation seems straight-forward, more or less c&p the code from insert/push_back/push_front and construct the items in-place instead. The tricky part however would be to stay compliant with older C++ versions, if that is a desired feature (and it seems to be considering that e.g. Boost.Move can be used instead of the C++11 move semantics). I do not have an idea how to do this as I'm not an experienced boost developer (or actually even user for that matter).

If older C++-compliance is not needed and my assumption of simply "c&ping insert/push_back/push_front" is confirmed by a boost developer, I could probably provide a patch a few weeks from now (my time is a bit limited at the moment) if required. If the compliance is needed however, I would prefer that a more experienced developer would implement it.

Attachments (2)

0001-Add-emplace_-back-front-to-circular_buffer.patch (4.5 KB ) - added by ai0867@… 5 years ago.
0002-Add-emplace_-back-front-to-circular_buffer_space_opt.patch (3.9 KB ) - added by ai0867@… 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Jan Gaspar, 9 years ago

Owner: changed from Jan Gaspar to No-Maintainer

comment:2 by Doug Brunner <doug.a.brunner@…>, 5 years ago

+1 to this, would be a welcome refinement.

comment:3 by ai0867@…, 5 years ago

I've attached two patches implementing emplace_front() and emplace_back() for circular_buffer and circular_buffer_space_optimized.

comment:4 by ai0867@…, 5 years ago

Also submitted as a pull request at https://github.com/boostorg/circular_buffer/pull/15

Note: See TracTickets for help on using tickets.