From 702d7f71c56eb9e467b03376017fc51271f6dcf2 Mon Sep 17 00:00:00 2001 From: Fantasmos Date: Sat, 28 Oct 2017 18:41:26 +1100 Subject: [PATCH] Replaced pair with temporary struct, to ensure POD-typing --- src/config/user_config.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/config/user_config.cpp b/src/config/user_config.cpp index d431cca34..fd2ad8459 100644 --- a/src/config/user_config.cpp +++ b/src/config/user_config.cpp @@ -345,11 +345,12 @@ MapUserConfigParam::MapUserConfigParam(const char* param_name, // add the default list va_list arguments; va_start(arguments, nb_elements); - typedef std::pair pair_type; //Necessary to prevent compile error below. Causes errors on some compilers though + + struct pair_type { T key; U value; }; for (int i = 0; i < nb_elements; i++) { - std::pair key_value_pair = va_arg(arguments, pair_type); - m_elements.insert(key_value_pair); + pair_type key_value_pair = va_arg(arguments, pair_type); + m_elements.insert(std::pair(key_value_pair.key, key_value_pair.value)); } va_end(arguments); // Cleans up the list } // MapUserConfigParam @@ -380,11 +381,12 @@ MapUserConfigParam::MapUserConfigParam(const char* param_name, // add the default list va_list arguments; va_start(arguments, nb_elements); - typedef std::pair PairType; //Necessary to prevent compile error below - + + struct pair_type { T key; U value; }; + for (int i = 0; i < nb_elements; i++) { - std::pair key_value_pair = va_arg(arguments, PairType); - m_elements.insert(key_value_pair); + pair_type key_value_pair = va_arg(arguments, pair_type); + m_elements.insert(std::pair(key_value_pair.key, key_value_pair.value)); } va_end(arguments); // Cleans up the list } // MapUserConfigParam