mardi 18 décembre 2018

iterate over tupe to get the next row

I have a below function:

bool GetNext(std::vector<int>& oid, uint8_t& numfield, uint8_t& offset, uint8_t& count, char& type)
{
    auto found = std::find_if(mMibsDetails.begin(), mMibsDetails.end(), [&](const MibsDetails & mibdt)
    {
        return std::equal(std::get<TUPLE_TBALE_OID_ID>(mibdt).begin(), std::get<TUPLE_TBALE_OID_ID>(mibdt).end(), oid.begin());
    });
    if(std::next(found, 1) != mMibsDetails.end())
    {
        oid = std::get<TUPLE_TBALE_ID_1>(*std::next(found, 1));
        numfield = std::get<TUPLE_TBALE_ID_2>(*std::next(found, 1));
        offset = std::get<TUPLE_TBALE_ID_3>(*std::next(found, 1));
        count = std::get<TUPLE_TBALE_ID_4>(*std::next(found, 1));
        type = std::get<TUPLE_TBALE_ID51>(*std::next(found, 1));
        return true;
    }
    return false;
}

Actually I want to implement the function to return the next row for a "found" value? But it is not happening - it returns the same row?

How can we iterate over a tuple to get next row?

Aucun commentaire:

Enregistrer un commentaire