Allocator Part of Type
jmh530
john.michael.hall at gmail.com
Thu Mar 15 19:36:10 UTC 2018
I recall some talk Andrei did where he said it was a bad idea to
make the allocator part of the type. However, the container
library in dlang-community(says it is backed with
std.experimental.allocator) contains allocator as part of the
type. Automem does too. Honestly, I would think you would really
be hobbled if you didn't. For instance, if you want to expand a
DynamicArray using the built-in ~= operator, then you really need
to know what the allocator is. Without ~= you'd have to rely on
functions (maybe member functions, maybe not).
So I suppose I'm wondering why is it a bad thing to include the
allocator as part of the type and why is it that it seems like in
practice that's how it is done anyway.
More information about the Digitalmars-d-learn
mailing list