<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">How should I do that? I wish I could do something like this:<br>
<br>
graph_t myGraph;<br>
<br>
fun_A(graph_t &amp;myGraph) {<br>
myGraph(array, edge_array + num_arcs, weights, num_nodes);<br>
}<br>
<br>
fun_B(graph_t &amp;myGraph) {<br>
// using myGraph to run some graph algorithm...<br>
}<br>
<br>
</blockquote><div><br>You can&#39;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:<br><br>graph_t fun_A() <br>
{ return graph_t(...); }<br><br>func_B(graph_t&amp; g)<br>{ ... }<br><br>main()<br>{<br>&nbsp; graph_t g = fun_A();<br>&nbsp; fun_B(g);<br>}<br><br>It might look like there&#39;s an unnecessary copy, but there won&#39;t be.<br>&nbsp;</div>
</div>Andrew Sutton<br><a href="mailto:andrew.n.sutton@gmail.com">andrew.n.sutton@gmail.com</a><br>