kazuho/picojson

parse sample with istream_iterator in README ignores whitespace in string

sakichan opened this issue · 0 comments

std::istream_iterator (actually, std::istream_iterator<char>) skips whitespace depending on the configuration of the underlying stream, and input streams are configured to skip whitespace by default.

So, the sample with std::istream_iterator in README ignores whitespace in string in JSON.

To fix this, std::noskipws manipulator should be applied to the stream, or the sample needs to use std::istreambuf_iterator<char> instead.