的std ::矢量

时间:2014-12-21 22:40:10

标签: c++

与元组我有这个代码

for (std::vector<std::tuple<uint32, std::string, uint32> >::const_iterator ixn = messages.begin(); ixn != messages.end(); ++ixn)
{
    if (std::get<0>(ixn) == user->getID() && std::get<1>(ixn) == msg && std::get<2>(itr) > time)
    {
         //some doin
    }
}

并说它

no matching function for call to ‘get(std::vector<std::tuple<long unsigned...

1 个答案:

答案 0 :(得分:1)

您需要使用(* ixn)取消引用迭代器。您的最后一个迭代器也称为itr而不是ixn

for (std::vector<std::tuple<uint32, std::string, uint32> >::const_iterator ixn = messages.begin(); ixn != messages.end(); ++ixn)
{
    if (std::get<0>(*ixn) == user->getID() && std::get<1>(*ixn) == msg && std::get<2>(*ixn) > time)
    {
         //some doin
    }
}