根据文件
A function that returns its first argument. This function is useful when writing code in the functional style.
Run Code Online (Sandbox Code Playgroud)
我想知道在哪里可以找到这样一个用例的好例子 - 在角度应用程序中编写功能样式的代码.谢谢
我只是想知道std :: identity的目的是什么?我在网上找不到任何有用的东西.我知道它是如何实现的:
template <typename T>
struct identity
{
T operator()(T x) const { return x; }
};
Run Code Online (Sandbox Code Playgroud)
为什么我们真的需要这个呢?