
Originally Posted by
NTL
Graph_ptr is just a boost pointer of type Graph.
do you mean a boost::shared_ptr ? if yes, in the line "Graph_ptr dataGraph = Graph_ptr(&dataGraphCopy);" you are constructing a shared pointer from a pointer to an object on the stack.
instead of
Code:
Graph dataGraphCopy = originalDataGraph;
Graph_ptr dataGraph = Graph_ptr(&dataGraphCopy);
you should write simply
Code:
Graph_ptr dataGraph( new Graph( originalDataGraph ) );
or
Code:
Graph_ptr dataGraph = boost::make_shared<Graph>( originalDataGraph );
anyway, the way you code makes me think you might not have a proper understanding of C++ basics ( and boost smart pointer library for what matters ). I say this because coding this way in C++ is dangerous and it inevitably leads to unstable/buggy programs even when they appear working as expected. Just a friendly warning ...
Bookmarks