Michael Sgier wrote:
why is he using such pointers? Why pointers anyway? Wouldn't there be a
more simple way to do such?
/// Pointer to array of pointers to cameras in the scene.
If the class (since this is a member) does not *create* the collection
of the cameras, it does make sense to have the member as a pointer to
that collection. The collection is apparently a simple array (most
likely dynamically allocated). Every element of the collection is a
pointer to a camera (most likely to provide polymorphic behaviour).
Hence the member is a pointer to a pointer.
Another solution would be a reference or a pointer to a vector of
pointers to cameras, like so
If the class wants to assume ownership for those elements, it could
declare the member to be a plain vector (and not a pointer to it), like
Anyway, the explanation is most likely in the same place where you got
your snippet. Asking us to speculate is not the best course of action
if you want to figure something out about the code you have.
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask