为什么没有 std::copy_if 算法? [英] Why there is no std::copy_if algorithm?

查看:21
本文介绍了为什么没有 std::copy_if 算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 C++ 中没有 std::copy_if 算法有什么具体原因吗?我知道我可以使用 std::remove_copy_if 来实现所需的行为.我认为它是在 C++0x 中出现的,但是一个简单的 copy_if 需要一个范围、一个输出迭代器和一个函子会很好.它只是简单地错过了还是背后有其他原因?

Is there any specific reason for not having std::copy_if algorithm in C++ ? I know I can use std::remove_copy_if to achieve the required behavior. I think it is coming in C++0x, but a simple copy_if which takes a range, a output iterator and a functor would have been nice. Was it just simply missed out or is there some other reason behind it?

推荐答案

根据 Stroustrup 的C++ 编程语言",这只是一个疏忽.

According to Stroustrup's "The C++ Programming Language" it was just an over-sight.

(作为引文,在 boost 邮件列表中回答了同样的问题:copy_if)

(as a citation, the same question answered in boost mail-lists: copy_if)

这篇关于为什么没有 std::copy_if 算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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