从代码的C++11部分降级

Downgrading from C++11 part of code

本文关键字:降级 C++11 代码      更新时间:2023-10-16

具体而言:

file.ignore(std::numeric_limits<std::streamsize>::max(), 'n');

它抛出以下错误:

  1. Numeric_limits不是std的一部分
  2. "<"之前应为主表达式代币
  3. 对max((的调用没有匹配的函数

它在VS中有效,但在Dev-cpp中无效。

我如何才能消除这些错误?

这不是C++03/C++11的问题,而是缺少include:

#include <limits>

模板std::numeric_limits<>已经存在很长时间了。