Why there is no std::copy_if algorithm?(为什么没有 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 算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么没有 std::copy_if 算法?


基础教程推荐
- 常量变量在标题中不起作用 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 这个宏可以转换成函数吗? 2022-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30