D
Damon
Hi,
I created a template class and stored its instances in a map object
that is like std::map<std::string, void* >. But i just made a nasty
discovery that if i fail to use a C-style cast properly with the void
pointer to return it to the proper class it belongs to, I get very bad
and random segmentation fault.
So question to all the experts, can I check the type of a void pointer
or use some guaranteed way to elicit an exception without going
segmentation fault? BTW, I'm using g++ v3.2.2. I know that if i try to
delete the instances of the template class that was cast wrongly, it
segfault but I can't trap it!
Thank you in advance! Merry X'mas to everyone.
Regards,
Damon
I created a template class and stored its instances in a map object
that is like std::map<std::string, void* >. But i just made a nasty
discovery that if i fail to use a C-style cast properly with the void
pointer to return it to the proper class it belongs to, I get very bad
and random segmentation fault.
So question to all the experts, can I check the type of a void pointer
or use some guaranteed way to elicit an exception without going
segmentation fault? BTW, I'm using g++ v3.2.2. I know that if i try to
delete the instances of the template class that was cast wrongly, it
segfault but I can't trap it!
Thank you in advance! Merry X'mas to everyone.
Regards,
Damon