QT Map移除元素(前n个)

    map<int, int> a;
    a[10] = 1;
    a[2] = 2;
    a[30] = 3;
    a[4] = 4;
    a[50] = 5;
    a[32] = 6;

    for(map<int, int>::iterator it = a.begin();it != a.end();it++ )
    {
        LOG(INFO) << "---- key :" << it->first << "value " << it->second;
        a.erase(it);
        break;
    }
    for(map<int, int>::iterator it = a.begin();it != a.end();it++ )
    {
        LOG(INFO) << "end---- key :" << it->first << "value " << it->second;
    }
上一篇:Code Review 是一场苦涩但有意思的修行


下一篇:STL 标准模板库