Use get instead of template get in REAMD.md and docs in non-template context (#4846)

Signed-off-by: Andy Choi <ccpong516@gmail.com>
This commit is contained in:
Andy Choi authored and GitHub committed 2025-10-30 10:23:04 +01:00
1 parent a6a92c19bf
commit cda9c1e3bd
23 files changed
+81 -81

No files matched your search

@@ -44,16 +44,16 @@ int main()
// deserialization
json j_running = "running";
json j_blue = "blue";
auto running = j_running.template get<ns::TaskState>();
auto blue = j_blue.template get<ns::Color>();
auto running = j_running.get<ns::TaskState>();
auto blue = j_blue.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.template get<ns::TaskState>();
auto unknown = j_pi.template get<ns::Color>();
auto invalid = j_pi.get<ns::TaskState>();
auto unknown = j_pi.get<ns::Color>();
std::cout << j_pi << " -> " << invalid << ", "
<< j_pi << " -> " << static_cast<int>(unknown) << std::endl;
}