std :: type_traits函数更改了vs19错误或错误的行为?

时间:2019-05-29 04:52:18

标签: c++ templates typetraits visual-studio-2019

以下代码在升级到vs19之前运行良好:

template <typename... Args> constexpr  Function Callback(std::function<void(Args...)> const f) {
    return [=]() {
      GlobalVar=sum((std::is_base_of<BaseC,std::remove_pointer<std::remove_reference<Args>::type>::type>::value)...); 
       f((static_cast<Args>(GetVar))...); };
};}

该代码适用于带有函数参数的模板函数,该函数返回一个lambda以使用GetVar的值执行参数(这是具有重载运算符的类实例),但是只是在将全局变量设置为函数将获得一个基类BaseC或它的指针或引用。

现在抛出这些错误:

Error   C2275    'std::remove_reference<int>::type': illegal use of this type as an expression  
Error   C2275    'std::remove_pointer<_Ty>::type': illegal use of this type as an expression    
Error   C2275    'std::remove_reference<char *>::type': illegal use of this type as an expression   
Error   C2955    'std::remove_pointer': use of class template requires template argument list   
Error   C2955    'std::is_base_of': use of class template requires template argument list
Error   C2923    'std::remove_pointer': 'std::remove_reference<int>::type' is not a valid template type argument for parameter '_Ty'    
Error   C2923    'std::is_base_of': 'std::remove_pointer<_Ty>::type' is not a valid template type argument for parameter '_Derived' 

0 个答案:

没有答案