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

[container.adaptors] uses_allocator specializations consistently use "Alloc" #5915

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Quuxplusone
Copy link
Contributor

This is not intended to trigger (nor un-trigger) any blanket wording; it's purely cosmetic, aligning the parameter names for the flat_foo containers' uses_allocator specializations, with the parameter names for stack/queue/priority_queue.

Intuitively, Alloc is the more appropriate name because this type is not necessarily something that qualifies as an Allocator; it is the same kind of type as the Alloc constructor parameters in [queue.defn] for example.

My understanding is that the old wording's choice to use Alloc in one specialization and Allocator in another is not motivated by any intentional difference in semantics between the two specializations; it's just a bit of inconsistency that we can patch up editorially.

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 8, 2022

Hm, is there a clear preference?

$ git grep 'class Allocator\b' | wc -l
438
$ git grep 'class Alloc\b' | wc -l
179

@Quuxplusone
Copy link
Contributor Author

Quuxplusone commented Nov 8, 2022

Hm, is there a clear preference?

$ git grep 'class Allocator\b' | wc -l
438
$ git grep 'class Alloc\b' | wc -l
179

Yes: places that require types that qualify as allocators tend to use Allocator, and places that don't require that tend to use Alloc. https://eel.is/c++draft/containers#sequence.reqmts-68.3 is an example; http://eel.is/c++draft/coro.generator.promise is another good example IMO.
I imagine there's still some inconsistency, but in general, my mental model is: "If it would happily accept a std::pmr::memory_resource*, it should be named Alloc not Allocator." (And if it wouldn't, vice versa.)

In the specific case of uses_allocator, I'm sure my mental model applies:

$ git grep 'uses_allocator<.*Allocator\b' | wc -l
      5 (after this PR, 0)
$ git grep 'uses_allocator<.*Alloc\b' | wc -l
      15 (after this PR, 20)

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 8, 2022

Ah, I see. Thank you! Let me take another look.

@Quuxplusone Quuxplusone force-pushed the flatfoo-uses-alloc branch 2 times, most recently from 58f21ce to 9ece2d6 Compare November 8, 2022 22:26
…"Alloc".

This is not intended to trigger (nor un-trigger) any blanket wording;
it's purely cosmetic, aligning the parameter names for the flat_foo
containers' `uses_allocator` specializations, with the parameter
names for stack/queue/priority_queue.

Intuitively, `Alloc` is the more appropriate name because this type
is not necessarily something that qualifies as an Allocator; it is
the same kind of type as the `Alloc` constructor parameters in
[queue.defn] for example.

My understanding is that the old wording's choice to use `Alloc` in
one specialization and `Allocator` in another is _not_ motivated by
any intentional difference in semantics between the two specializations;
it's just a bit of inconsistency that we can patch up editorially.
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

2 participants