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

Remove section 2 from [sequence.reqmts] #6571

Merged
merged 1 commit into from Nov 8, 2023

Conversation

mattreecebentley
Copy link
Contributor

I have been requested to make this a direct request rather than putting it in P0447.

Despite the cute poem, section 2 should be removed because the note is misleading and over-simplified. The section conflates time complexity and performance, and oddly recommends vector as a default without mentioning its time complexity, unlike the other containers. Time complexity's relevance to both performance and latency is subject to architectural differences. If the committee chose to re-include such a note, it should simply describe time complexity as below (being removed may be better as it creates less confusion):

[Note 1: The sequence containers offer the programmer different complexity trade-offs. vector has amortized constant time complexity for insertions at the end of the sequence, and constant time complexity for erasures at the end of the sequence. hive, list and forward_list have constant time complexity for insertions and erasures at any point in the sequence, however for hive the user cannot specify the insertion position. deque has constant time complexity for insertions and erasures at the beginning or end of the sequence. -end note]

I have been requested to make this a direct request rather than putting it in P0447.

Despite the cute poem, section 2 should be removed because the note is misleading and over-simplified. See Appendix J of P0447 for a more complete basic guide to container selection. Such a guide is too large to fit in the standard and will be subject to changes in architecture in terms of usefulness. The section conflates time complexity and performance, and oddly recommends vector as a default without mentioning its time complexity, unlike the other containers. Time complexity's relevance to both performance and latency is subject to architectural differences. If the committee chose to re-include such a note, it should simply describe time complexity as below (being removed may be better as it creates less confusion):

[Note 1: The sequence containers offer the programmer different complexity trade-offs. vector has amortized constant time complexity for insertions at the end of the sequence, and constant time complexity for erasures at the end of the sequence. hive, list and forward_list have constant time complexity for insertions and erasures at any point in the sequence, however for hive the user cannot specify the insertion position. deque has constant time complexity for insertions and erasures at the beginning or end of the sequence. -end note]
Copy link
Member

@jensmaurer jensmaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with removing this educational-looking note.

@jwakely should have an opinion, too.

@tkoeppe tkoeppe merged commit 2b5fc29 into cplusplus:main Nov 8, 2023
2 checks passed
@tvaneerd
Copy link
Contributor

tvaneerd commented Dec 9, 2023

😢

@CaseyCarter
Copy link
Contributor

I suppose we don't need this poem. But you can pry the limerick from my cold, dead fingers!

@mattreecebentley
Copy link
Contributor Author

😢

"Deque and vector go together, with O(1) back insertion (amortized).
Unordered maps don't have push_back, you can't control position (by design).
List and forward_list are unique, they've got unique() and merging.
For something basic try array, with at-worst O(n) searching. "

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 this pull request may close these issues.

None yet

6 participants