有没有理由在标准库中没有std :: identity? [英] Is there a reason why there is not std::identity in the standard library?

查看:113
本文介绍了有没有理由在标准库中没有std :: identity?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用C ++处理通用代码时,我会找到一个 std :: identity 函子(例如 std :: negate )非常有用。

When dealing with generic code in C++, I would find a std::identity functor (like std::negate) very useful. Is there a particular reason why this is not present in the standard library?

推荐答案

在引入std :: identity之后不久,出现问题了吗?开始出现,与与cdp98之前的std :: identity的定义冲突以扩展名出现: https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/vrrtKvA7cqo
该网站可能会更多历史记录。

Soon after std::identity was introduced, issues began to appear, starting with conflicts to pre-cpp98 definitions of std::identity appearing as extensions: https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/vrrtKvA7cqo This site might give a little more history for it.

这篇关于有没有理由在标准库中没有std :: identity?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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