Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relaxing the Requirements for the Constant Time Versions of erase_begin and erase_end #51

Open
ldeng-ustc opened this issue Oct 16, 2024 · 0 comments · May be fixed by #52
Open

Relaxing the Requirements for the Constant Time Versions of erase_begin and erase_end #51

ldeng-ustc opened this issue Oct 16, 2024 · 0 comments · May be fixed by #52

Comments

@ldeng-ustc
Copy link

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<int, int>, 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<value_type> to is_trivially_destructible, allowing types like std::pair<int, int> or other user-defined simple types to benefit from the faster erase_begin and erase_end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant