【发布时间】:2012-03-22 17:26:29
【问题描述】:
我目前正在使用模拟器,在调试运行时遇到以下错误:Expression: vector incompatible iterators
代码如下:
class Network {
private:
vector<Node*> nodes;
....
void parse_config(void);
....
};
在 parse_config 方法中,我有一个生成错误的序列。就是这样:
if(nodes.empty()) // add the first node to the network
{
Node current(regex_d[1]); // create current(first src) node
Node *acurrent = ¤t;
Node next_hop(regex_d[2]); // create the node we immediately send to
Node *anext_hop = &next_hop;
acurrent->add_next_hop(anext_hop);
acurrent->add_n_vchannels(regex_d[5]);
nodes.push_back(acurrent); // <== error
nodes.push_back(anext_hop); // <== here as well
}
有解决办法吗? 任何帮助/建议/参考将不胜感激。
塞比
【问题讨论】:
-
您在
push_back本身或尝试使用这些指针时遇到错误?
标签: c++ debugging vector assertion