boostorg / boostorg/circular_buffer

Relaxing the Requirements for the Constant Time Versions of `erase_begin` and `erase_end`

Open
#51 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
65
Forks
64
PR merge metrics
No merged PRs in 30d

Description

Currently, the constant time versions of `erase_begin` and `erase_end` are only applied when `value_type` is a scalar type. However, this requirement is overly restrictive.

For example, in the case of `std::pair`, the current `circular_buffer` requires `O(n)` time to perform `erase_end`, which is actually unnecessary.

The `O(n)` version of erase seems to simply destruct elements. Therefore, would it be possible to relax the condition for the fast erase versions from `is_scalar` to `is_trivially_destructible`, allowing types like `std::pair` or other user-defined simple types to benefit from the faster `erase_begin` and `erase_end`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.