Is there a reason why there is not std::identity in the standard library?

若如初见. 提交于 2019-12-07 01:32:35

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/35907848/is-there-a-reason-why-there-is-not-stdidentity-in-the-standard-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!