1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-31 10:24:23 +03:00

Deployed 6e36c721f with MkDocs version: 1.4.2

This commit is contained in:
Niels Lohmann
2023-09-23 17:28:29 +02:00
parent 55f10f44a9
commit 6a2266aff4
273 changed files with 663 additions and 697 deletions

View File

@ -44,16 +44,16 @@ int main()
// deserialization
json j_running = "running";
json j_blue = "blue";
auto running = j_running.get<ns::TaskState>();
auto blue = j_blue.get<ns::Color>();
auto running = j_running.template get<ns::TaskState>();
auto blue = j_blue.template get<ns::Color>();
std::cout << j_running << " -> " << running
<< ", " << j_blue << " -> " << static_cast<int>(blue) << std::endl;
// deserializing undefined JSON value to enum
// (where the first map entry above is the default)
json j_pi = 3.14;
auto invalid = j_pi.get<ns::TaskState>();
auto unknown = j_pi.get<ns::Color>();
auto invalid = j_pi.template get<ns::TaskState>();
auto unknown = j_pi.template get<ns::Color>();
std::cout << j_pi << " -> " << invalid << ", "
<< j_pi << " -> " << static_cast<int>(unknown) << std::endl;
}