我有这些错误我无法修复:
template< class char_type, class traits_type>
class invalid_streambuf : public std::basic_streambuf< char_type, traits_type>
{
typedef std::basic_streambuf< char_type, traits_type> base_class;
using typename base_class::int_type;
...
virtual int_type overflow(int_type nChar)
{ return 0; }
...
}
'int_type' 没有命名类型
template< class char_type, class traits_type>
class basic_thread_safe_log
: protected basic_message_handler_log< char_type, traits_type>
{
typedef basic_message_handler_log< char_type, traits_type> base_class;
using typename base_class::string_type;
void on_last_message( const string_type & str)
{
assert ( str.empty());
}
...
}
ISO C++ 禁止声明没有类型的“string_type”
最佳答案
您似乎尝试使用在生成类时应该知道的类型,但它们不是您的模板类的参数,因此它们不存在。
在这里,您可以简单地通过使用 typedef 而不是使用来解决问题。
关于c++ - 未知类型 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3925675/