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

[allocator.requirements.general]/98 make sure SimpleAllocator meets t… #6152

Merged
merged 1 commit into from Mar 12, 2023

Conversation

blackteahamburger
Copy link
Contributor

[[nodiscard]] is not required.

operator== needs to be a template, otherwise the original will be ambiguous with the rewritten candidate, for example:

SimpleAllocator<int> a;
SimpleAllocator<float> b;
a == b;

There are two candidates:

bool SimpleAllocator<int>::operator==(const SimpleAllocator<int>&) const;
bool SimpleAllocator<float>::operator==(const SimpleAllocator<float>&) const; // rewritten candidate

Neither candidate is better than the other, hence ambiguous.

@jensmaurer
Copy link
Member

@jwakely ?

@frederick-vs-ja
Copy link
Contributor

[[nodiscard]] was added by commit adb3bdb, presumably from the wording change in P0600R1 (although the commit mentioned R0). I'm not sure whether it'd be better to drop it.

@tkoeppe tkoeppe merged commit 40cfc37 into cplusplus:main Mar 12, 2023
@blackteahamburger blackteahamburger deleted the alloc branch March 19, 2023 04:17
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