MCPcopy Create free account
hub / github.com/DmitriBogdanov/UTL / main

Function main

examples/module_json/complex_structure_reflection.cpp:34–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32UTL_JSON_REFLECT(TaskList, map_of_tasks, matrix_of_points);
33
34int main() {
35 using namespace utl;
36
37 const TaskList task_list = {
38 // Map of tasks
39 {
40 { "task_1", { "input_1.dat", "output_1.dat", 170. } },
41 { "task_2", { "input_2.dat", "output_2.dat", 185. } }
42 },
43 // Matrix of 3D points
44 {
45 { { 0, 0, 0}, { 1, 0, 0 } },
46 { { 0, 1, 0}, { 0, 0, 1 } }
47 }
48 };
49
50 // Parse JSON from struct,
51 // this also doubles as a way of stringifying structs for debugging
52 std::cout << json::from_struct(task_list).to_string();
53}

Callers

nothing calls this directly

Calls 2

from_structFunction · 0.50
to_stringMethod · 0.45

Tested by

no test coverage detected