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

P2363 Extending associative containers with the remaining heterogeneous overloads #1037

Closed
wg21bot opened this issue Apr 25, 2021 · 12 comments · Fixed by cplusplus/draft#6360
Labels
B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e C++26 Targeted at C++26 IS Ship vehicle: IS LWG Library plenary-approved Papers approved for inclusion in their target vehicle by plenary vote. size - medium paper size estimate
Milestone

Comments

@wg21bot
Copy link
Collaborator

wg21bot commented Apr 25, 2021

P2363R0 Extending associative containers with the remaining heterogeneous overloads (Konstantin Boyarinov, Sergey Vinogradov, Ruslan Arutyunyan)

@wg21bot wg21bot added the LEWG Library Evolution label Apr 25, 2021
@wg21bot wg21bot added this to the 2021-telecon milestone Apr 25, 2021
@brycelelbach brycelelbach added ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review labels May 17, 2021
@brycelelbach brycelelbach added B3 - addition Bucket 3 as described by P0592: material that is not mentioned in P0592 size - medium paper size estimate C++23 Targeted at C++23 and removed scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review labels May 26, 2021
@brycelelbach brycelelbach added ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list IS Ship vehicle: IS and removed ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting labels Aug 1, 2021
@brycelelbach brycelelbach added ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review expedited-library-evolution-electronic-poll Papers that were reviewed on the mailing list and then advanced directly to electronic polling. and removed ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list labels Sep 17, 2021
@wg21bot
Copy link
Collaborator Author

wg21bot commented Sep 20, 2021

P2363R1 Extending associative containers with the remaining heterogeneous overloads (Konstantin Boyarinov, Sergey Vinogradov, Ruslan Arutyunyan)

@brycelelbach brycelelbach removed the expedited-library-evolution-electronic-poll Papers that were reviewed on the mailing list and then advanced directly to electronic polling. label Nov 3, 2021
@inbal2l
Copy link
Collaborator

inbal2l commented Nov 3, 2021

This was reviewed in ML at 2021-09-27, summarizing the main topics:

Summary

Comment: A concern about turning ill-formed code into runtime exception:

std::set<std::shared_ptr<int>, std::owner_less<>> s;
std::weak_ptr<int> w = /* ... */;
s.insert(w);

This is currently ill-formed because weak_ptr's conversion to shared_ptr is explicit.
The user can choose to ask exception if the weak_ptr is expired by an explicit conversion, or they can choose to get an empty shared_ptr by using w.lock().
With this change the code would become well-formed, but throw bad_weak_ptr at runtime if the weak_ptr is expired
(...) I'm not (yet) taking a position beyond that the problem should be acknowledged and analyzed in the paper.
is distinguishing between explicit meaning "morally the same thing, but conversion is expensive" and "totally different thing" is tricky, and the  example I gave with shared_ptr and weak_ptr is also in the gray area between the two. It may well be a price we have to pay if we want string/string_view to work (and that's like the use case for this, so it had better work). 
       
Authors: (Editor's summary):
I believe this is a relatively rare use-case. I don’t expect that the types that are allowed to be converted explicitly would be also comparable. (...) The solution is to have explicit ctor, this will affect the performance in common use cases.
(...) with having the constraint for explicitness we would force the user to write explicit conversion (to be able to call the overload with key_type) and kill the performance for the described use-case.
We have the implementation based on LLVM libc++ and we already can observe some performance degradation. (...) I believe the mentioned use-case can be considered common enough. And I don’t think that forcing the user to write
something like string_view_variable.data() to be passed to heterogeneous overload is friendly. Please share your perspective.

Comment: Currently, for heterogeneous lookup, the unique-key associative containers do not require that there is at most one match (https://lists.isocpp.org/lib-ext/2019/05/11645.php)
I think the paper should discuss what happens in such cases, particularly for insert_or_assign, operator[], and at (and what try_emplace returns on failure)

     struct HalfIs { int pt; };
     struct Cmp {
     bool operator()(int x, int y) const noexcept { return x < y; }
     bool operator()(int x, HalfIs p) const noexcept { return x / 2 < p.pt;
     }
     bool operator()(HalfIs p, int x) const noexcept { return p.pt < x / 2; }
     using is_transparent = void;
     };

     std::set<int, Cmp> s{ 1, 2, 3, 4, 5, 6 };
     s.find(HalfIs{2});

     In this example, HalfIs{2} compares equivalent to both 4 and 5.
     
Authors: (Editor's summary):
(...) Without the paper applied that code would insert 4 value. With that proposal applied insert would go in heterogeneous lookup and thus, finds 5 and doesn't modify the container. I don't think this use-case is very common, though (I mean that one when you have both homo and heterogeneous comparator). Users should really understand what they are doing. 
And most importantly I am not sure that the current state of the art (without heterogeneous insertion operations) is somthing we want to live with.

Outcome

Please provide a new revision for the paper, which will capture the concerns brought up, and the authors' position.
(few fundamental topics came up. Best to schedule the new revision for LEWG Telecon)

@brycelelbach brycelelbach added ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list and removed ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review C++23 Targeted at C++23 labels Nov 4, 2021
@cor3ntin cor3ntin added C++23 Targeted at C++23 needs-revision Paper needs changes before it can proceed labels Dec 8, 2021
@wg21bot
Copy link
Collaborator Author

wg21bot commented Dec 18, 2021

P2363R2 Extending associative containers with the remaining heterogeneous overloads (Konstantin Boyarinov, Sergey Vinogradov, Ruslan Arutyunyan)

@wg21bot wg21bot removed the needs-revision Paper needs changes before it can proceed label Dec 18, 2021
@jensmaurer jensmaurer modified the milestones: 2021-telecon, 2022-telecon Jan 1, 2022
@cor3ntin cor3ntin added the expedited-library-evolution-electronic-poll Papers that were reviewed on the mailing list and then advanced directly to electronic polling. label Jan 13, 2022
@brycelelbach
Copy link

brycelelbach commented Jan 17, 2022

@cor3ntin
Copy link

cor3ntin commented Feb 16, 2022

2022-01 Library Evolution Electronic Poll Outcomes

Send [P2363R3] (Extending Associative Containers With The Remaining Heterogeneous Overloads) to Library Working Group for C++23, classified as an addition ([P0592R4] bucket 3 item).

SF F N A SA
17 17 1 1 0

Consensus in favor

@cor3ntin cor3ntin added LWG Library and removed LEWG Library Evolution ready-for-library-evolution-electronic-poll This paper needs to undergo a Library Evolution electronic poll scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review expedited-library-evolution-electronic-poll Papers that were reviewed on the mailing list and then advanced directly to electronic polling. labels Feb 16, 2022
@brycelelbach brycelelbach added expedited-library-evolution-electronic-poll Papers that were reviewed on the mailing list and then advanced directly to electronic polling. lwg-pending LWG Chair needs to disposition labels Feb 23, 2022
@brycelelbach brycelelbach added B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e and removed B3 - addition Bucket 3 as described by P0592: material that is not mentioned in P0592 labels Apr 19, 2022
@JeffGarland JeffGarland added C++26 Targeted at C++26 and removed C++23 Targeted at C++23 labels Jul 11, 2022
@JeffGarland
Copy link
Member

Changing target to C++26 -- LWG is out of time for 23.

@cmazakas
Copy link

@joaquintides and I are implementing P2363 for Boost.Unordered and we believe there's a missing constraint in the implementation of transparent unordered_set insert.

Under this proposal as-is, set.insert(set.begin(), set.end()) results in an ambiguity when the Hash and KeyEqual parameters contain their is_transparent member typedefs as the compiler can't decide between insert(const_iterator, K&&) and insert(iterator, iterator).

The wording should be updated to include extra verbiage, similar to try_emplace's constraints:

For the second overload, is_convertible_v<K&&, const_iterator> and is_convertible_v<K&&, iterator>
are both false.

@tahonermann
Copy link
Collaborator

@cmazakas, please don't use this github repo to discuss issues with the design or wording of a paper. This repo is only intended to be used for tracking the status of a paper. Please use the WG21 mailing lists or other public resources or contact the paper authors for further discussion.

@wg21bot
Copy link
Collaborator Author

wg21bot commented Jan 16, 2023

P2363R4 Extending associative containers with the remaining heterogeneous overloads (Konstantin Boyarinov, Sergey Vinogradov, Ruslan Arutyunyan)

@JeffGarland JeffGarland removed the lwg-pending LWG Chair needs to disposition label Feb 7, 2023
@JeffGarland
Copy link
Member

https://wiki.edg.com/bin/view/Wg21issaquah2023/P2363R5-20230209

poll: include P2363R5 in C++26?

F A N
7 0 0

@JeffGarland JeffGarland added the lwg-future-plenary ready to go to plenary but working draft isn't open so we are waiting label Feb 10, 2023
@wg21bot
Copy link
Collaborator Author

wg21bot commented Feb 20, 2023

P2363R5 Extending associative containers with the remaining heterogeneous overloads (Konstantin Boyarinov, Sergey Vinogradov, Ruslan Arutyunyan)

@JeffGarland JeffGarland added the tentatively-ready-for-plenary Reviewed between meetings; ready for a vote. label May 23, 2023
@JeffGarland JeffGarland removed expedited-library-evolution-electronic-poll Papers that were reviewed on the mailing list and then advanced directly to electronic polling. lwg-future-plenary ready to go to plenary but working draft isn't open so we are waiting labels Jun 13, 2023
@cor3ntin cor3ntin added plenary-approved Papers approved for inclusion in their target vehicle by plenary vote. and removed tentatively-ready-for-plenary Reviewed between meetings; ready for a vote. labels Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e C++26 Targeted at C++26 IS Ship vehicle: IS LWG Library plenary-approved Papers approved for inclusion in their target vehicle by plenary vote. size - medium paper size estimate
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

8 participants