#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
거대한 문자열의 사본이 필요하지 않습니다. null로 끝나는 문자열 포인터이면 충분합니다. 그러나 istringstream
의 ctor
은 std::string_view
(C++ 1z 만 해당) 대신 인수가 std::string
입니다.istringstream을보다 효율적으로 만드는 방법은 무엇입니까?
그런 경우에 std::istringstream
을 더 효율적으로 만들 수있는 해결 방법이 있습니까?
이것이 이유인지는 모르겠지만 내부 저장소가 'stringbuf'에 의해 뒷받침 되었기 때문에 지원되지 않는다고 생각됩니다. 이유는 '문자열 _보기'를 허용하지 않기 때문입니다. –