======================================== Complex Object Test ========================================
| 1896 | // Complex Object Test |
| 1897 | // ======================================== |
| 1898 | static void complex_object_test() { |
| 1899 | ImGui::SeparatorText("Complex Test"); |
| 1900 | ImGui::PushID("Complex Test"); |
| 1901 | |
| 1902 | ImGui::Text("std::map<std::string, std::deque<std::tuple<std::vector<std::pair<std::string, std::tuple<int, bool, double>>>, std::array<std::list<std::set<std::string>>, 4>, std::map<int, std::vector<std::optional<std::string>>>>>>; "); |
| 1903 | HelpMarker("Complex nested object test"); |
| 1904 | |
| 1905 | using crazy = |
| 1906 | std::map< |
| 1907 | std::string, |
| 1908 | std::deque< |
| 1909 | std::tuple< |
| 1910 | std::vector<std::pair<std::string, std::tuple<int, bool, double>>>, |
| 1911 | std::array<std::list<std::set<std::string>>, 4>, |
| 1912 | std::map<int, std::vector<std::optional<std::string>>> |
| 1913 | > |
| 1914 | > |
| 1915 | >; |
| 1916 | |
| 1917 | static crazy my_crazy_variable = []() { |
| 1918 | crazy result; |
| 1919 | |
| 1920 | // ========== Entry 1: "player_data" ========== |
| 1921 | { |
| 1922 | std::deque<std::tuple< |
| 1923 | std::vector<std::pair<std::string, std::tuple<int, bool, double>>>, |
| 1924 | std::array<std::list<std::set<std::string>>, 4>, |
| 1925 | std::map<int, std::vector<std::optional<std::string>>> |
| 1926 | >> player_deque; |
| 1927 | |
| 1928 | // First tuple in deque |
| 1929 | { |
| 1930 | // Vector of pairs: name -> (score, alive, multiplier) |
| 1931 | std::vector<std::pair<std::string, std::tuple<int, bool, double>>> vec1 = { |
| 1932 | {"Alice", {1500, true, 2.5}}, |
| 1933 | {"Bob", {2300, true, 1.8}}, |
| 1934 | {"Charlie", {950, false, 0.0}}, |
| 1935 | {"Diana", {3100, true, 3.2}} |
| 1936 | }; |
| 1937 | |
| 1938 | // Array of 4 lists of sets |
| 1939 | std::array<std::list<std::set<std::string>>, 4> arr1; |
| 1940 | arr1[0] = { {"sword", "shield", "potion"} }; |
| 1941 | arr1[1] = { {"first_kill", "level_10"}, {"speedrun", "pacifist"} }; |
| 1942 | arr1[2] = { {"forest", "cave", "town"}, {"mountain", "desert"} }; |
| 1943 | arr1[3] = { {"main_quest_1", "side_quest_3"} }; |
| 1944 | |
| 1945 | // Map: player_id -> messages |
| 1946 | std::map<int, std::vector<std::optional<std::string>>> map1; |
| 1947 | map1[1001] = { std::string("Welcome!"), std::string("Good luck!"), std::nullopt }; |
| 1948 | map1[1002] = { std::string("Hello there"), std::nullopt, std::string("Goodbye") }; |
| 1949 | map1[1003] = { std::nullopt, std::string("Achievement unlocked!") }; |
| 1950 | |
| 1951 | player_deque.push_back(std::make_tuple(vec1, arr1, map1)); |
| 1952 | } |
| 1953 | |
| 1954 | // Second tuple in deque |
| 1955 | { |
no test coverage detected