Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何找到具有验证特定条件的值的 stl 矢量元素列表。例如,如果我有一个 int 值向量
vector<int> V;
我想得到所有大于 5 的元素。
提前致谢。
如果std::copy_if()值:
std::copy_if()
std::vector<int> target; std::copy_if(v.begin(), v.end(), std::back_inserter(target), std::bind(std::less<int>(), 5, _1));