1
0
mirror of https://github.com/nlohmann/json synced 2024-09-20 06:40:13 +00:00

Corrected readme

Internally, the elements in a map are always sorted by its key following a specific strict weak ordering criterion indicated by its internal comparison object (of type Compare).
With string type, the default comparator is alphabetical order, and thus two come after three.
This commit is contained in:
Annihil 2016-03-02 02:01:40 +01:00
parent 53879f9c99
commit 78a020354d

View File

@ -301,7 +301,7 @@ Likewise, any associative key-value containers (`std::map`, `std::multimap`, `st
```cpp ```cpp
std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} }; std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };
json j_map(c_map); json j_map(c_map);
// {"one": 1, "two": 2, "three": 3} // {"one": 1, "three": 3, "two": 2 }
std::unordered_map<const char*, double> c_umap { {"one", 1.2}, {"two", 2.3}, {"three", 3.4} }; std::unordered_map<const char*, double> c_umap { {"one", 1.2}, {"two", 2.3}, {"three", 3.4} };
json j_umap(c_umap); json j_umap(c_umap);