#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传递的。
这是符合标准的行为还是只是一个错误?
答案 0 :(得分:4)
std::function
的构造函数用于接受太阳下的所有内容(它是template<class F> function(F f)
)。
然后它受标准约束(LWG issue 2132),但实现该约束需要表达SFINAE,Microsoft's compiler doesn't yet support。