Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
🛠️ for
flat_set
#4050🛠️ for
flat_set
#4050Changes from 7 commits
536c00d
2cb6462
a251a3e
bf6b06a
cfde52b
d7e8768
4ca5b9b
b9be818
fa6c030
9f2e612
6bcbbe6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, without this constraint, when the comparer is transparent inputs like
non-const _Kty&
will go into this function. The case will be correctly handled by_Emplace
, but I think it will be better just fall toinsert(const _Kty&)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append_range
should be considered an optimization here.I notice that
insert_range(end,...)
(instead ofappend_range
) is unconditionally required for sequence containers. However, I think we don't have to give an extra check for that chance, as it is likely that a container that doesn't supportappend_range
will not supportinsert_range
either.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I find these funtions lack
forward
(required by the standard):STL/stl/inc/stack
Lines 115 to 117 in 48eedd3
STL/stl/inc/queue
Lines 125 to 127 in 48eedd3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we forward here? It seems that
std::forward
merely rejects non-borrowed-range rvalues, which defends dangling.But we are eagerly consuming ranges here, so it seems to me that we can just use the ranges as lvalues for containers. CC-ing @cor3ntin @ericniebler @CaseyCarter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd really hope to add noexcept enhancement for
replace
, but I have no idea how to deal with this_STL_ASSERT
:(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was making
test_comparer_application
fail to compile.... though this "fixes" the problem, I'm afraid we need to look into what is actually going on around this.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not a compiler bug, the code is rejected by both msvc, gcc and clang :|
https://godbolt.org/z/jT6sT4EfT (the error message given by msvc is the strangest one though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea how to represent this gracefully :( It might be helpful to an additional version of
_STL_ASSERT
that repeat error message just like_STL_INTERNAL_CHECK
andassert
.Also, these references in
static_assert
are not correct, as_Base_flat_set
is also the base forflat_multiset
.STL/stl/inc/flat_set
Lines 47 to 49 in 6bedc29
STL/stl/inc/flat_set
Lines 65 to 66 in 6bedc29