|
|
Am 17.09.2016 um 22:41 schrieb clipka:
> I love it when a plan comes together.
Oh, and while I'm at it:
#declare MyFnord = array { "Element 0", "Element 1" };
#declare MyFnord[2] = "Element 2";
#declare MyFnord[3] = "Element 3";
#declare MyFnord[42] = "Uqbar";
https://github.com/POV-Ray/povray/releases/tag/v3.7.1-x.dictionary.8791118
Sorry, one-dimensional only. Also, it's not designed as a sparse array,
nor a stack, nor a double-ended queue, nor whatever. Just a plain stupid
array that behaves as if it had no upper limit.
Also, there are a few caveats:
- An index larger than the current capacity of the array will /always/
adjust its capacity, even when just testing whether the element has been
set:
#ifndef (MyFnord[9999999999])
// Whoops! MyFnord has now grabbed enough memory to
// accomodate 10000000000 entries.
- The array is a bit greedy, and may grab as much as twice the necessary
size, in order to avoid having to constantly adjust its capacity.
- There is currently no way to shrink the array (aside from copying it
into a new array and throwing away the old one entirely).
- There is currently no way to test whether an array is of the new
dynamic flavour or a plain old one-dimensional fixed-size array.
- I'm still looking for some neat syntax to access the element right
beyond the current size, i.e. some shorthand for:
MyFnord[dimension_size(MyFnord,0)]
Post a reply to this message
|
|