[Issue 8550] std.container.InlinedArray

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 15 15:34:42 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8550



--- Comment #3 from bearophile_hugs at eml.cc 2012-08-15 15:34:34 PDT ---
(In reply to comment #2)
> This is called small array optimization except for size of array is hardwired
> so that the whole struct fits a couple of words. I suggest to just add it to
> std.container.Array.

Yes, this is similar to small array optimization, but this variant of the idea
allows you to tune how much space you want to save locally.

Beside staticLen, this InlinedArray also optionally takes the Tlen type. If you
are using something very small, like ubytes or chars or shorts, and you want to
pack as many of them as possible in the local static array, you are allowed to
define Tlen as ubyte (or ushort) instead of uint or size_t. So
InlinedArray!(int,1) takes 12 bytes and stores up to 11 ubytes/chars.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list