Dynamically Sized Structs

Dicebot public at dicebot.lv
Wed Apr 16 17:55:17 PDT 2014


On Wednesday, 16 April 2014 at 23:36:05 UTC, bearophile wrote:
> Jeroen Bollen:
>
>> Is it possible to have a structure with a dynamic size?
>
> See an usage example I have written here:
> http://rosettacode.org/wiki/Sokoban#Faster_Version
>
> But that code requires a very updated compiler. Otherwise you 
> will need a little different code.
>
> Bye,
> bearophile

Just in case, the key line to pay attention to in that example is 
this one:

CellIndex[0] c_;

It is a commonly used C idiom for dynamically sized structures 
that D also supports.


More information about the Digitalmars-d-learn mailing list