Optimal struct layout template?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Dec 15 11:46:28 PST 2008
BCS wrote:
> Reply to Andrei,
>
>> BCS wrote:
>>
>>> would "align 1" work?
>>>
>> That could make things excruciatingly slow. What's really needed is
>> (in first approximation) to sort the members in decreasing order of
>> size. Odd-sized arrays of char foil this plan to some extent, which is
>> where the fun begins.
>>
>> Andrei
>>
>
> ??
>
> http://en.wikipedia.org/wiki/Bin_packing_problem
>
It's not a bin packing problem because the restrictions are very
different. Clearly it's not a simple problem either! I wonder if it's
NP-hard, and I highly doubt it (in fact I'm almost sure it isn't)
because it can be easily decomposed into smaller subproblems.
Andrei
More information about the Digitalmars-d
mailing list