+ fixed documentation bugs

This commit is contained in:
Niels 2014-12-30 11:57:58 +01:00
parent 2335d3f3d5
commit 6995d33fb1
2 changed files with 9 additions and 6 deletions

View file

@ -86,8 +86,10 @@ You can also use streams:
```cpp
// create object from stream
std::stringstream ss;
ss << "{ \"pi\": 3.141, \"happy\": true }";
JSON j;
j << "{ \"pi\": 3.141, \"happy\": true }";
j << ss;
// write string representation to stream
std::cout << j;
@ -150,8 +152,8 @@ The type of the JSON object is determined automatically by the expression to sto
```cpp
/// strings
std::string s1 = "Hello, world!";
JSON js = s;
std::string s2 = j;
JSON js = s1;
std::string s2 = js;
// Booleans
bool b1 = true;

View file

@ -1791,9 +1791,10 @@ JSON::Parser::Parser(std::istream& _is)
// from http://www.manticmoo.com/articles/jeff/programming/c++/making-io-streams-efficient-in-c++.php
// Don't sync C++ and C I/O
std::ios_base::sync_with_stdio(false);
while(_is) {
std::getline(_is, input_line);
string_input += input_line;
while (_is)
{
std::getline(_is, input_line);
string_input += input_line;
}
_length = string_input.size();