|
![](/i/fill.gif) |
In article <3d2194d3$1@news.povray.org> , "cadman"
<REM### [at] povray co uk> wrote:
> Therein lies the problem. I guess I forgot that part of the code: location
> is of type (void *). I want location (and all elements of the array) to be
> able to hold anything (pointer to a texture, an object, a vector,...). MFC,
> of course, has untyped pointer collection classes, but I'm hoping for a
> certain degree of portability here...
Well, if you really, really want such a mess, this
((CMyObject *)(*location))=thing;
and/or this should work
*location=(void*)thing;
depending on what you are really doing.
However, I strongly suggest you don't mess around with void pointers in such
a way. The proper way is to inherit everything array can hold from a common
base class and let array point to those.
It is absolutely inappropriate to use void for what you try to do in C++ and
there is no excuse. Of course, I know you will probably ignore this advice
and in a few weeks fight against constant crashes, but then don't ask how to
fix those -- you already know the answer now ;-)
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |