#include <sstream>
using namespace std;
const char* GetHugeString();
int main()
{
const char* p = GetHugeString();
//
// Below will copy the huge string into a std::string object!
//
istringstream sstrm{p};
return {};
}
istringstream
doesn't need a copy of the huge string; a null-terminated string pointer is enough. But istringstream
's ctor
only take std::string
, rather than std::string_view
(c++1z only), as its argument.
Is there a work-around to make std::istringstream
more efficient in such a case?