robmar wrote:what size constant? I think this all seems so simple, that is until you try it! Then you get Error! Void and abstract class ptr to ptrs not legal...
Array of pointers is always possible, array of abstract objects is not possible.
If you had taken a look at the link I gave you where this code was you would see that it compiled fine and executed like it should.
CuteAlier wrote:But what I couldn't figure out is the additional size restriction - so the function can only pass a pointer to an array of a certain size.
Well, in the first post - he uses MAX_LIGHTS. So I thought the idea is passing an array of a constant size - and only of that constant size. I didn't try for long, but I failed with restricting the function parameter to allow only that (passing that as value is again easy syntax).
Don´t waste your time then if you´re not interested in bothering to test even your own ideas.
The aim is to find the best way to have a ptr to an array of ptrs, and ideally using [indexing] for access, not ptr+offset math, which isn´t always portable.
robmar wrote:
The aim is to find the best way to have a ptr to an array of ptrs, and ideally using [indexing] for access, not ptr+offset math, which isn´t always portable.
Well my snippet does that just fine, so I don't really get what else you need.
I don't really think size restriction is a good idea anyways.
@ randomMesh: Isn't a static_cast enough in this case? Should be I think (and yeah, I'm not compiling - done enough coding today ^_^).
edit: Also I agree it's certainly better passing the size parameter instead of a constant size. I'm just curious about the constant thing because I can't figure that one out (at least not without starting to browse google etc).
@randonmesh: No, it was to be able to pass a (ILightSceneNode *array[8]) pointer to a callback, so the callback could extract light positions directly.
VS C++ rejects it saying its an abstract class and not allowed, so I´ve had to pass (vector3df *array[8]), which works, but then I have to reload the array in the run loop each frame cycle.
As the size of the array is related to the size of a memory pointer, which is the same for all things, can´t see why the compiler should not allow it for classes, or void ptrs, which is even stranger!
There must be some ISO wisdom there somewhere... or something obvious... but what?