identity 结构

一个将类型定义作为模板参数提供的结构。

语法

struct identity {
   typedef Type type;
   Type operator()(const Type& left) const;
};

参数

left
要识别的值。

注解

此类包含公共类型定义 type,其与模板参数 Type 相同。 它与模板函数 forward 结合使用,从而确保函数参数具有所需的类型。

为与旧版代码兼容,此类还定义了 identity 函数 operator(),该函数会返回其参数 left