为什么在VC2015RC

时间:2015-05-28 06:31:53

标签: c++ c++11 visual-c++ typetraits std-function

#include <functional>
using namespace std;

int main()
{
   static_assert(is_constructible<function<int(int)>, int(*)(int,int)>::value, "error");
}

代码不是用GCC和Clang编译的,而是用Visual C ++ 2015 RC传递的。

这是符合标准的行为还是只是一个错误?

1 个答案:

答案 0 :(得分:4)

std::function的构造函数用于接受太阳下的所有内容(它是template<class F> function(F f))。

然后它受标准约束(LWG issue 2132),但实现该约束需要表达SFINAE,Microsoft's compiler doesn't yet support