
Andrew Sutton-2 wrote:
How should I do that? I wish I could do something like this:
graph_t myGraph;
fun_A(graph_t &myGraph) { myGraph(array, edge_array + num_arcs, weights, num_nodes); }
fun_B(graph_t &myGraph) { // using myGraph to run some graph algorithm... }
You can't invoke a constructor on an object that is already created - well, you probably can, but I seriously doubt that you want to. Instead, just return myGraph from fun_A:
graph_t fun_A() { return graph_t(...); }
func_B(graph_t& g) { ... }
main() { graph_t g = fun_A(); fun_B(g); }
It might look like there's an unnecessary copy, but there won't be.
Andrew Sutton andrew.n.sutton@gmail.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I tried as you suggested, and it does work in Release mode (Visual Studio 2005), but NOT in Debug mode. Very strange. The CPU keeps running at the line return myGraph; and does not go further. Any suggestions? Thanks! -- View this message in context: http://www.nabble.com/-BGL--passing-a-graph-from-one-function-to-another-tp2... Sent from the Boost - Users mailing list archive at Nabble.com.