POV-Ray : Newsgroups : povray.programming : void pointer array problem : Re: void pointer array problem Server Time
28 Jul 2024 08:26:24 EDT (-0400)
  Re: void pointer array problem  
From: Thomas Willhalm
Date: 2 Jul 2002 06:35:03
Message: <3d2181d7@news.povray.org>
cadman wrote:

> This is probably more a general C++ question, but I'm working on a POV
> project, so I know you'll be glad to help.  How do I assign some typed
> pointer X to an element of a void pointer array?  

Are you sure that there's no better way? Something like 
"Pointer to base class" or even better an auto_pointer to a base class.
If you put these auto_pointers into the standard container "vector",
deallocation could be handled cleanly by the destructor.

Of course, it depends heavily on your application, whether my suggestions
make sense, but that's why they are suggestions. (Personally, I try to 
avoid pure pointers and arrays whenever it's possible.)

Best regards 
Thomas


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.