为什么VC2015RC下的`is_constructible< function< int(int)&gt ;, int(*)(int,int)> :: value`是true [英] Why `is_constructible<function<int(int)>, int(*)(int,int)>::value` is true under VC2015RC

查看:66
本文介绍了为什么VC2015RC下的`is_constructible< function< int(int)&gt ;, int(*)(int,int)> :: value`是true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#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。

The code doesn't compile with GCC and Clang, but passed with Visual C++ 2015 RC.

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

Is this standard compliant behavior or just a bug?

推荐答案

std :: function 的构造函数用于接受阳光下的所有东西(这是 template< class F>函数(F f) )。

std::function's constructor used to accept everything under the sun (it was a template<class F> function(F f)).

然后,它就被标准限制了(由 LWG问题2132 ),但是实现该约束需要表达式SFINAE,该表达式 Microsoft的编译器尚不支持

Then it got constrained in the standard (by LWG issue 2132), but implementing that constraint requires expression SFINAE, which Microsoft's compiler doesn't yet support.

这篇关于为什么VC2015RC下的`is_constructible&lt; function&lt; int(int)&gt ;, int(*)(int,int)&gt; :: value`是true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆