如何使用remove-erase习语来删除向量中的空向量? [英] How to use remove-erase idiom for removing empty vectors in a vector?

查看:48
本文介绍了如何使用remove-erase习语来删除向量中的空向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用诸如从向量中删除元素.我该如何在以下位置应用

I have some trouble with removing a empty vector in a vector using the remove-erase idiom like Erasing elements from a vector. How can I apply this on:

vector<vector<Point> > contours; // want to remove contours.at(i).empty()
contours.erase(remove(contours.begin(), contours.end(), ??? ),contours.end());

推荐答案

您是否尝试过:

contours.erase(remove(contours.begin(), contours.end(), vector<Point>()), contours.end());

这篇关于如何使用remove-erase习语来删除向量中的空向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆