我有这个代码:
if (((boost::get< 1>(*i)) == node1) || ((boost::get< 2>(i*)) == node2))
{
cout << "on this tuple "<< boost::get<1>(*i) << "we found it" << endl;
}
并且给了我这个错误,知道它在说什么:
main.cpp:172: error: expected primary-expression before ‘)’ token
这是检查元组向量以了解哪个具有值,如下所示:
void threaded_function(Model_factory &mf, ppa::Node *root)
{
boost::mutex::scoped_lock lock(result_mutex);
if(!running_jobs.empty())
{
boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple = running_jobs.front();
cout << "getting the lock for " << running_jobs.front() << " on "
<< lock.owns_lock() << endl;
running_jobs.pop();
lock.unlock();
ppa::Node *n = boost::get<0>(tuple);
ppa::Node *n1 = boost::get<1>(tuple);
ppa::Node *n2 = boost::get<2>(tuple);
bool check = boost::get<3>(tuple);
// n2->start_alignment_new(&mf);
//n1->start_alignment_new(&mf);
cout << " name " << n->get_name() << " has seq" << n->node_has_sequence_object<< " " << n->left_child->get_distance_to_parent()
<< " " << n->right_child->get_distance_to_parent() << " this done = " << check << endl;
n->start_alignment_new(&mf);
cout << " name " << n->get_name() << " has seq " << n->node_has_sequence_object<< " " << " lock " << lock.owns_lock() << endl;
boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> tuple2 = wait.front();
ppa::Node *node = boost::get<0>(tuple2);
ppa::Node *node1 = boost::get<1>(tuple2);
ppa::Node *node2 = boost::get<2>(tuple2);
bool check2 = boost::get<3>(tuple);
typedef vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> >::iterator vec_iter;
for (vec_iter i = wait.begin(); i != wait.end(); ++i)
{
if (((boost::get< 1>(*i)) == node1) || ((boost::get< 2>(i*)) == node2))
{
cout << "on this tuple "<< boost::get<1>(*i) << "we found it" << endl;
}
else
{
cout << "false found" << endl;
}
}
}