ostringstream给了我隐式实例化错误

ostringstream gives me Implicit instantiation error

本文关键字:实例化 错误 ostringstream      更新时间:2023-10-16

我正在尝试这个答案中提供的优雅解决方案,但无论我尝试什么,我都无法通过这一行的错误Implicit instantiation of undefined template:

std::ostringstream strs;

我需要做什么?我已经包括了以下内容,我确信这是多余的。第二个问题似乎很难确定ostringstream到底需要包含什么:

#include <iostream>
#include <fstream>
#include <iosfwd>
#include <ios>

stringstream类是在sstream头文件中定义的,所以写

#include <sstream>

一切都会好起来的