decltype
decltypeキーワードは、エンティティの宣言されたタイプ、または式のタイプと値の分類をチェックするために使用されます。
文法:
decltype ( expression )
decltype 使用
// 尾置返回允许我们在参数列表之后声明返回类型
template <typename It>
auto fcn(It beg, It end) -> decltype(*beg)
{
// 处理序列
return *beg; // 返回序列中一个元素的引用
}
// 为了使用模板参数成员,必须用 typename
template <typename It>
auto fcn2