diff --git a/include/components/config.hpp b/include/components/config.hpp index 2cf216ec..0f3b4546 100644 --- a/include/components/config.hpp +++ b/include/components/config.hpp @@ -67,8 +67,8 @@ class config { template T get(const string& section, const string& key, const T& default_value) const { try { - T result{get(section, key)}; string string_value{get(section, key)}; + T result{convert(string{string_value})}; return dereference(move(section), move(key), move(string_value), move(result)); } catch (const key_error& err) { return default_value; @@ -93,7 +93,7 @@ class config { while (true) { try { string string_value{get(section, key + "-" + to_string(results.size()))}; - T value{get(section, key + "-" + to_string(results.size()))}; + T value{convert(string{string_value})}; if (!string_value.empty()) { results.emplace_back(dereference(section, key, move(string_value), move(value))); @@ -123,7 +123,7 @@ class config { while (true) { try { string string_value{get(section, key + "-" + to_string(results.size()))}; - T value{get(section, key + "-" + to_string(results.size()))}; + T value{convert(string{string_value})}; if (!string_value.empty()) { results.emplace_back(dereference(section, key, move(string_value), move(value))); @@ -220,8 +220,9 @@ class config { section = string_util::replace(section, "self", current_section, 0, 4); try { - T result{get(section, key)}; - return dereference(string(section), move(key), get(section, key), move(result)); + string string_value{get(section, key)}; + T result{convert(string{string_value})}; + return dereference(string(section), move(key), move(string_value), move(result)); } catch (const key_error& err) { throw value_error("Unexisting reference defined [" + section + "." + key + "]"); }