Hi,
I have some code like this,
vector<MyNode*getNodes() {
return theNodes;
}
int func() {
vector<MyNode*nodes;
nodes.insert(nodes.end(), getNodes().begin(), getNodes().end());
}
This code crashes on Windows using VC7 compiler. In debuging it I
find that I have to change the code to:
int func() {
vector<MyNode*nodes, tmp_nodes;
tmp_nodes=getNodes();
nodes.insert(nodes.end(), tmp_nodes.begin(), tmp_nodes.end());
}
It looks like I can use begin() and end() directly to a function
return, but I am wondering why?