Discussion: Copying void *?
Afficher un message
Vieux 21/02/2008, 23h08   #1
Travis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Copying void *?

So I had a Tree (custom written) that had, as a node type, as pretty
simple class. The class just stored some std::string's plus a void*.

So my tree instantiation use to be Tree <myClass *> myTree so adding a
new looked something like

myTree.Insert( new myClass( "string 1", "string 2", (void*) 2) ); //
seemed to work fine

Then I decided it was silly to store a tree of pionters, and changed
the tree to Tree <myClass> myTree so adding looked more like...

myTree.Insert( myClass( "string 1", "string 2", (void*) 2) ); //
crashes?

This insertion style compiles but the later one it crashes and I'm not
sure why. It would *appear* that the void* at some point goes NULL or
otherwise erroneous.

Just looking for some educated thoughts/opinions. Thanks.
  Réponse avec citation
 
Page generated in 0,04713 seconds with 9 queries