diff --git a/toml/get.hpp b/toml/get.hpp index 42ba7ba..0ca5435 100644 --- a/toml/get.hpp +++ b/toml/get.hpp @@ -635,9 +635,7 @@ get_or(const basic_value& v, T&& opt) } template class M, template class V> -detail::enable_if_t::type>::type, - std::string>::value, std::string>& +detail::enable_if_t::value, std::string>& get_or(basic_value& v, T& opt) { try @@ -662,7 +660,7 @@ get_or(basic_value&& v, T&& opt) } catch(...) { - return opt; + return std::string(opt); } } @@ -673,7 +671,7 @@ template class M, template class V> detail::enable_if_t::type>::value, std::string> -get_or(basic_value&& v, T&& opt) +get_or(const basic_value& v, T&& opt) { try { @@ -692,9 +690,10 @@ template class M, template class V> detail::enable_if_t>>, - detail::negation>, + detail::negation::type>::type>>, detail::negation::type>> - >::value, T> + >::value, typename std::remove_reference::type> get_or(const basic_value& v, T&& opt) { try @@ -704,7 +703,7 @@ get_or(const basic_value& v, T&& opt) } catch(...) { - return opt; + return std::forward(opt); } }