Skip to content

Commit

Permalink
docs: styles of sample
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Jan 23, 2024
1 parent 968778e commit 52634ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ void parsing()
}

std::list<int> to_list = value["list"].as_collection<int, std::list>();
to_list = (std::list<int>)value["list"]; // same as above
to_list = value["list"].as<std::list<int>>(); // same as above
to_list = (std::list<int>)value["list"]; // same as above
to_list = value["list"].as<std::list<int>>(); // same as above

std::set<int> to_set = value["list"].as_collection<int, std::set>();
to_set = (std::set<int>)value["list"]; // same as above
to_set = value["list"].as<std::set<int>>(); // same as above
to_set = (std::set<int>)value["list"]; // same as above
to_set = value["list"].as<std::set<int>>(); // same as above

bool is_map = value["author"].is<std::map<std::string, std::string>>();

Expand All @@ -137,8 +137,8 @@ void parsing()
to_map = value["author"].as<std::map<std::string, std::string>>(); // same as above

auto to_hashmap = value["author"].as_map<std::string, std::unordered_map>();
to_hashmap = (std::unordered_map<std::string, std::string>)value["author"]; // same as above
to_hashmap = value["author"].as<std::unordered_map<std::string, std::string>>(); // same as above
to_hashmap = (std::unordered_map<std::string, std::string>)value["author"]; // same as above
to_hashmap = value["author"].as<std::unordered_map<std::string, std::string>>();// same as above

// Output: "literals"
using namespace json::literals;
Expand Down
4 changes: 2 additions & 2 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ void parsing()
to_map = value["author"].as<std::map<std::string, std::string>>(); // same as above

auto to_hashmap = value["author"].as_map<std::string, std::unordered_map>();
to_hashmap = (std::unordered_map<std::string, std::string>)value["author"]; // same as above
to_hashmap = value["author"].as<std::unordered_map<std::string, std::string>>(); // same as above
to_hashmap = (std::unordered_map<std::string, std::string>)value["author"]; // same as above
to_hashmap = value["author"].as<std::unordered_map<std::string, std::string>>();// same as above

// Output: "literals"
using namespace json::literals;
Expand Down

0 comments on commit 52634ac

Please sign in to comment.