c – 编译器抱怨模板参数的数量错误,即使它在boost库文件中是正
发布时间:2020-12-16 07:26:46 所属栏目:百科 来源:网络整理
导读:boost库中有一个名为has_new_operator.hpp的文件.当我使用GCC 4.3.1压缩文件时,我收到以下错误 type_traits/has_new_operator.hpp:45: error: wrong number of template arguments (1,should be 2) type_traits/has_new_operator.hpp:24: error: provided fo
boost库中有一个名为has_new_operator.hpp的文件.当我使用GCC 4.3.1压缩文件时,我收到以下错误
根据第24行,它需要2个参数,这就是第42行传递的内容.另外,如果你观察第31行,那么已经完成了相同但编译器没有抱怨它. 21: namespace boost { 22: namespace detail { 23: template <class U,U x> 24: struct test; 25: 26: template <typename T> 27: struct has_new_operator_impl { 28: template<class U> 29: static type_traits::yes_type check_sig1( 30: U*,31: test< 32: void *(*)(std::size_t),33: &U::operator new 34: >* = NULL 35: ); 36: template<class U> 37: static type_traits::no_type check_sig1(...); 39: template<class U> 40: static type_traits::yes_type check_sig2( 41: U*,42: test< 43: void *(*)(std::size_t,const std::nothrow_t&),44: &U::operator new 45: >* = NULL ); 解决方法
看来你的当前代码看不到std :: size_t.您可以尝试#include< iostream>在此代码之前.
Simulating your error. Fixing your error. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |