关于C#:将C 11代码转换为C 98

Converting C++11 code into the C++98

代码:

1
2
3
4
5
while ((row = mysql_fetch_row(pRes))) {
        TMPTable temp = {};
        if (row[0]) temp.con = strtoul(row[0], NULL, 10);
        std::vector<MATable>.push_back(temp);
}

TMPTable temp = {};

的行上出错

in C++98 'temp' must be initialized by constructor, not by '{...}'

另一个问题是:

std::ostringstream query;

给出错误:

aggregate 'std::ostringstream query' has incomplete type and cannot be defined

我已经尝试过在google上解决问题的方法,但是还没有找到任何可行的方法...总是以错误结尾。你们能指出我正确的方向吗?


您需要包括<sstream>以获得std::ostringstream的定义。要解决初始化问题,您可以简单地使用

1
TMPtable tmp = TMPtable();