Phobos 3 Discussion Notes - 02-01-2024
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Wed Feb 7 22:13:26 UTC 2024
On 08/02/2024 11:00 AM, Jonathan M Davis wrote:
> That being said, I would expect most D code to go with the templated
> approach. It's what D typically does, and the kind of folks who want to use
> allocators are usually also the kind of folks who aren't going to be very
> happy about passing classes around.
I do not.
There isn't enough of a win to introducing allocators, unless you have
knowledge of internals.
At which point you don't need to template your container upon the
composable allocator. You'll have a dedicated one internally that isn't
virtual.
This is one of my key take aways, don't pretend you need to customize
the memory allocator to its usage if you don't know how it would be
used. Go slower, go virtual, it'll keep you sane and allow you to build
cool things.
Remember to profile. Not guess.
More information about the Digitalmars-d
mailing list