Qt篇——QVector遍历数据并删除符合条件的元素

以int集合为例

//在Qt中,删除xxxList这QVector的int集合中大于1000的数据
int temp = 1000;
xxxList.erase(
        std::remove_if(
               xxxList.begin(),
               xxxList.end(),
                [=](int i) {
                        return i > temp;
                }
        ),
        xxxList.end()
);

猜你喜欢

转载自blog.csdn.net/u011391361/article/details/131049431