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

P2249 R6 Mixed comparisons for smart pointers #981

Open
wg21bot opened this issue Feb 22, 2021 · 10 comments
Open

P2249 R6 Mixed comparisons for smart pointers #981

wg21bot opened this issue Feb 22, 2021 · 10 comments
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 LEWG Library Evolution 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 size - small paper size estimate
Milestone

Comments

@wg21bot
Copy link
Collaborator

wg21bot commented Feb 22, 2021

P2249R0 Mixed comparisons for smart pointers (Giuseppe D'Angelo)

@wg21bot wg21bot added LEWG Library Evolution LEWGI Library Evolution Incubator labels Feb 22, 2021
@wg21bot wg21bot added this to the 2021-telecon milestone Feb 22, 2021
@cor3ntin cor3ntin added ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list and removed LEWGI Library Evolution Incubator labels Feb 22, 2021
@brycelelbach brycelelbach added the scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review label May 26, 2021
@cor3ntin
Copy link

Mailing list review, June 15 - July 26 2021

There seems to be a limited interest (4 participants).
Some discussions about wording where we established that the proposed wording correctly forbids comparison between different pointer types.
Because this was not immediately obvious the paper might want to clarify.

Action items:

  • Try to provide a stronger motivation
  • Consider making the proposed operator hidden friends
  • Add a paragraph explaining how the wording works

We do not need to see this again in mailing list review. I think this can be reviewed by LEWG with low priority

@cor3ntin cor3ntin added size - small paper size estimate needs-revision Paper needs changes before it can proceed ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting and removed ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review labels Jul 26, 2021
@wg21bot
Copy link
Collaborator Author

wg21bot commented Jul 30, 2021

P2249R1 Mixed comparisons for smart pointers (Giuseppe D'Angelo)

@wg21bot wg21bot removed the needs-revision Paper needs changes before it can proceed label Jul 30, 2021
@brycelelbach brycelelbach added ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e C++23 Targeted at C++23 IS Ship vehicle: IS and removed ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting C++23 Targeted at C++23 labels Aug 1, 2021
@brycelelbach
Copy link

Sending this back to mailing list review again, hopefully it can go directly from there to electronic ballot.

@brycelelbach brycelelbach added the scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review label Sep 24, 2021
@wg21bot
Copy link
Collaborator Author

wg21bot commented Oct 26, 2021

P2249R2 Mixed comparisons for smart pointers (Giuseppe D'Angelo)

@inbal2l
Copy link
Collaborator

inbal2l commented Nov 6, 2021

Was seen by LEWG mailing list review, on 10-11.
Attaching a short summary of the discussion (we've looked at R2: https://isocpp.org/files/papers/P2249R2.html)

Summary

  1. Issue: Not sure the facility has verbosity benefit over existing code
    For example, this can be done with: auto it = std::ranges::find_if(objects, [=](auto&& o) { return o.get() == input; })

  2. Issue: Do we really want sp == x to work everywhere sp.get() == x works, rather than requiring convertibility of x to the type of sp.get()?

  3. Issue: Recommendation to use the first instead of the second (or if not, to add rationale to the paper):

    1. (https://godbolt.org/z/P4exEeoqW)
    template<class U>
        requires std::equality_comparable_with<element_type*, U>
           friend bool operator==(const shared_ptr& a, const U& b);
    1. (https://godbolt.org/z/v1Gcv5Eq5) (currently in the paper)
    friend bool operator==(const shared_ptr& a, element_type* b);

    The former works for types that are implicitly constructible from T* and comparable with T*, whereas the latter doesn't. Both forms work for types that are implicitly convertible to T*, which includes array and function types.

  4. Issue: consider the following use case:

        template<class T> struct my_ptr: shared_ptr<T> {
             using shared_ptr<T>::shared_ptr;
        };
        
        int main() {
             return std::equality_comparable< my_ptr<int> >;
        }

    Editor's comment: since users should not inherit from shared_ptr, you might want to rephrase the use case (unless this demonstrates something else).

Outcome

Please add the fixes / rationale requested to a new revision. 
It will be best to discuss this paper in the same LEWG telecon as P2404, P2405.

@inbal2l inbal2l added needs-revision Paper needs changes before it can proceed and removed ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review labels Nov 6, 2021
@jensmaurer jensmaurer removed this from the 2021-telecon milestone Nov 12, 2021
@wg21bot
Copy link
Collaborator Author

wg21bot commented Nov 26, 2021

P2249R3 Mixed comparisons for smart pointers (Giuseppe D'Angelo)

@wg21bot wg21bot removed the needs-revision Paper needs changes before it can proceed label Nov 26, 2021
@wg21bot wg21bot added this to the 2021-telecon milestone Nov 26, 2021
@brycelelbach brycelelbach added C++26 Targeted at C++26 ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list labels Dec 22, 2021
@jensmaurer jensmaurer modified the milestones: 2021-telecon, 2022-telecon Jan 1, 2022
@wg21bot
Copy link
Collaborator Author

wg21bot commented Jan 22, 2022

P2249R4 Mixed comparisons for smart pointers (Giuseppe D'Angelo)

@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 and removed ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list labels Jun 19, 2022
@nliber
Copy link
Collaborator

nliber commented Aug 2, 2022

2022-07-26 Library Evolution Telecon

P2249R4: Mixed comparisons for smart pointers

2022-07-26 Library Evolution Telecon Minutes

Chair: Nevin Liber

Minute Taker: Ben Craig

Champion: Giuseppe D'Angelo

Summary

There were concerns over the unspecified behavior of comparing raw pointers, but those are addressed in the paper by using compare_three_way to perform the operations (although the paper could be clearer on that).

More concerning was ambiguities that could arise if other smart pointers (such as observer_ptr) also adds these comparison operators.

POLL: We should promise more committee time to pursuing P2249, knowing that our time is scarce and this will leave less time for other work.

Outcome: No objection to unanimous consent

Next Steps

Author to return with a paper exploring the ambiguities when mixed comparisons are added to more than one type of smart pointer.

@nliber nliber 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 labels Aug 2, 2022
@brycelelbach brycelelbach added ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting needs-revision Paper needs changes before it can proceed labels Aug 3, 2022
@jensmaurer jensmaurer removed this from the 2022-telecon milestone Jan 25, 2023
@wg21bot
Copy link
Collaborator Author

wg21bot commented Feb 16, 2024

P2249R5 Mixed comparisons for smart pointers (Giuseppe D'Angelo)

@wg21bot wg21bot removed the needs-revision Paper needs changes before it can proceed label Feb 16, 2024
@wg21bot wg21bot added this to the 2024-telecon milestone Feb 16, 2024
@wg21bot wg21bot changed the title P2249 Mixed comparisons for smart pointers P2249 R5 Mixed comparisons for smart pointers Feb 16, 2024
@wg21bot
Copy link
Collaborator Author

wg21bot commented Feb 16, 2024

P2249R6 Mixed comparisons for smart pointers (Giuseppe D'Angelo)

@wg21bot wg21bot changed the title P2249 R5 Mixed comparisons for smart pointers P2249 R6 Mixed comparisons for smart pointers Feb 16, 2024
@inbal2l inbal2l added the scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review label Feb 16, 2024
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 LEWG Library Evolution 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 size - small paper size estimate
Projects
Development

No branches or pull requests

6 participants