-
Notifications
You must be signed in to change notification settings - Fork 767
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
[deque.modifiers] Clarify complexity requirements on deque insertion #7732
Comments
Uhm, I hope you don't expect the editors to make a judgment call on the phrasing here? @jwakely , do you feel empowered to take a pick? |
This is really tricky. "Constant time" is correct for operations on elements (i.e. single construction in this case), but the wording is somehow unhelpful.
I guess there should be an LWG issue for specifying numbers of operations on "pointers", along with allocations and deallocations. |
I thought it best to leave the editorial decisions on exact phrasing to the editors :) If you or @jwakely would prefer, I'd be happy to open a PR with my preference, but I suspect that will end with one of you telling me how to change my PR, which would be more efficient if you just owned it. For context if you missed it, this is fallout from the lib mailing list thread "Should std::list::reverse be O(1)" which @jwakely is involved in. |
Well, there are apparently technical questions on whether "number of operations on possibly fancy pointers from the allocator" should matter for the complexity specification. Answering such questions doesn't seem editorial. |
[deque.modifiers]/2 states:
This is misleading since all real-world implementations of deque are only amortized constant time when inserting at the end, due to the need to grow (hopefully exponentially) the mapping array. I think there are a few possible solutions here, some of which make sense to combine:
The text was updated successfully, but these errors were encountered: