void build_queues() {
for (int i = 1; i < configVector.size(); i++) {
//ROUTER -> ROUTER
if (configVector[i][0] == "3") {
if (atoi(configVector[i][1].c_str()) == ROUTER_ID) {
int connectedId = atoi(configVector[i][3].c_str());
Queue tmp;
tmp.initialize(get_ip_for_id(connectedId), QUEUE_LENGTH, connectedId);
NUM_INTERFACES++;
interfaces.push_back(tmp);
} else if (atoi(configVector[i][3].c_str()) == ROUTER_ID) {
int connectedId = atoi(configVector[i][1].c_str());
Queue tmp;
tmp.initialize(get_ip_for_id(connectedId), QUEUE_LENGTH, connectedId);
NUM_INTERFACES++;
interfaces.push_back(tmp);
}
}
//ROUTER -> END HOST
else if (configVector[i][0] == "4") {
if (atoi(configVector[i][1].c_str()) == ROUTER_ID) {
int connectedId = atoi(configVector[i][4].c_str());
Queue tmp;
tmp.initialize(get_ip_for_id(connectedId), QUEUE_LENGTH, connectedId);
NUM_INTERFACES++;
interfaces.push_back(tmp);
}
}
}
}
接口是矢量&lt;队列&gt;。每当我push_back多个队列时,它会给我无效的指针错误。有谁可以指出错误?