If T[new] is the container for T[], then what is the container for T[U]?

Craig Black craigblack2 at cox.net
Sun Apr 26 15:49:18 PDT 2009


Just my 2 cents.  I use a C++ array template that optimizes memory usage by 
only storing a pointer.  It stores the capacity and the size in the heap 
allocation.  The benefit here is that empty arrays only require one word.  I 
am the primary author of a simulation engine (similar to a game engine but 
less graphics-focused).  In practice I have found about half of all arrays 
are empty, so this approach provides much better memory efficiency for my 
purposes.

-Craig 




More information about the Digitalmars-d mailing list