C++11模板元编程 std::enable_if示例详解

chuzhaosheng42644 8 0 PDF 2021-02-01 06:02:02

C++11中引入了std::enable_if函数,函数原型如下: template< bool xss=removed> struct enable_if; 可能的函数实现: template struct enable_if {}; template struct enable_if { typedef T type; }; 由上可知,只有当第一个模板参数为true时,enable_if会包含一个type=T的公有成员,否则没有该公有成员。 头文件: #include <type_t

用户评论
请输入评论内容
评分:
暂无评论