【发布时间】:2019-02-14 11:08:39
【问题描述】:
#include <iostream>
#include <type_traits>
#include <iomanip>
using namespace std;
template<typename T>
bool f(T&& v)
{
return is_function_v<decltype(forward<T>(v))>;
}
int main()
{
cout << boolalpha
<< is_function_v<decltype(setw)>
<< endl;
cout << boolalpha
<< f(setw)
<< endl;
return 0;
}
输出是:(clang 6.0 & gcc 8.0)
>
是的
假
但我期望的结果应该是:
>
是的
是的
为什么std::is_function_v 没有按预期工作?
【问题讨论】:
标签: c++ c++11 templates standards typetraits