How Different Are Templates from Generics

jmh530 john.michael.hall at gmail.com
Sun Oct 13 03:48:02 UTC 2019


On Saturday, 12 October 2019 at 21:44:57 UTC, Jonathan M Davis 
wrote:
> [snip]


Thanks for the reply.

As with most people, I don't write a lot of D code that uses 
classes that much.

The use case I'm thinking of is with allocators, which - to be 
honest - is not something I deal with much in my own code. 
Basically, some of the examples have stuff like 
ScopedAllocator!Mallocator, which would imply that there is a 
different ScopedAllocator for each allocator. However, if you 
apply Java's generics, then you would just have one. Not sure if 
it would make any kind of difference in real-life code, but still 
interesting to think about.


More information about the Digitalmars-d-learn mailing list