fix typo in examples
This commit is contained in:
parent
0feea6168d
commit
699e0a923c
12 changed files with 11 additions and 12 deletions
|
@ -6,7 +6,7 @@ using json = nlohmann::json;
|
|||
int main()
|
||||
{
|
||||
// create JSON object
|
||||
json object =
|
||||
const json object =
|
||||
{
|
||||
{"the good", "il buono"},
|
||||
{"the bad", "il cattivo"},
|
||||
|
|
|
@ -8,7 +8,7 @@ int main()
|
|||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to the first element
|
||||
// get an iterator to the first element
|
||||
json::iterator it = array.begin();
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
|
|
|
@ -8,7 +8,7 @@ int main()
|
|||
// create an array value
|
||||
const json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to the first element
|
||||
// get an iterator to the first element
|
||||
json::const_iterator it = array.cbegin();
|
||||
|
||||
// serialize the element that the iterator points to
|
||||
|
|
|
@ -8,7 +8,7 @@ int main()
|
|||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to one past the last element
|
||||
// get an iterator to one past the last element
|
||||
json::const_iterator it = array.cend();
|
||||
|
||||
// decrement the iterator to point to the last element
|
||||
|
|
|
@ -14,7 +14,6 @@ int main()
|
|||
std::cout << std::boolalpha
|
||||
<< j.contains("/number"_json_pointer) << '\n'
|
||||
<< j.contains("/string"_json_pointer) << '\n'
|
||||
<< j.contains("/string"_json_pointer) << '\n'
|
||||
<< j.contains("/array"_json_pointer) << '\n'
|
||||
<< j.contains("/array/1"_json_pointer) << '\n'
|
||||
<< j.contains("/array/-"_json_pointer) << '\n'
|
||||
|
|
|
@ -8,7 +8,7 @@ int main()
|
|||
// create a JSON object
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
|
||||
// call find
|
||||
// call count()
|
||||
auto count_two = j_object.count("two");
|
||||
auto count_three = j_object.count("three");
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ int main()
|
|||
// create an array value
|
||||
json array = {1, 2, 3, 4, 5};
|
||||
|
||||
// get am iterator to one past the last element
|
||||
// get an iterator to one past the last element
|
||||
json::iterator it = array.end();
|
||||
|
||||
// decrement the iterator to point to the last element
|
||||
|
|
|
@ -13,7 +13,7 @@ int main()
|
|||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call erase
|
||||
// call erase()
|
||||
j_boolean.erase(j_boolean.begin());
|
||||
j_number_integer.erase(j_number_integer.begin());
|
||||
j_number_float.erase(j_number_float.begin());
|
||||
|
|
|
@ -13,7 +13,7 @@ int main()
|
|||
json j_array = {1, 2, 4, 8, 16};
|
||||
json j_string = "Hello, world";
|
||||
|
||||
// call erase
|
||||
// call erase()
|
||||
j_boolean.erase(j_boolean.begin(), j_boolean.end());
|
||||
j_number_integer.erase(j_number_integer.begin(), j_number_integer.end());
|
||||
j_number_float.erase(j_number_float.begin(), j_number_float.end());
|
||||
|
|
|
@ -8,7 +8,7 @@ int main()
|
|||
// create a JSON object
|
||||
json j_object = {{"one", 1}, {"two", 2}};
|
||||
|
||||
// call erase
|
||||
// call erase()
|
||||
auto count_one = j_object.erase("one");
|
||||
auto count_three = j_object.erase("three");
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ int main()
|
|||
// create a JSON array
|
||||
json j_array = {0, 1, 2, 3, 4, 5};
|
||||
|
||||
// call erase
|
||||
// call erase()
|
||||
j_array.erase(2);
|
||||
|
||||
// print values
|
||||
|
|
|
@ -6,7 +6,7 @@ using json = nlohmann::json;
|
|||
int main()
|
||||
{
|
||||
// create JSON array
|
||||
json array = {"first", "2nd", "third", "fourth"};
|
||||
const json array = {"first", "2nd", "third", "fourth"};
|
||||
|
||||
// output element at index 2 (third element)
|
||||
std::cout << array.at(2) << '\n';
|
||||
|
|
Loading…
Reference in a new issue