From ae2bafa90709142025a5520eebd2c8eba2266da2 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Mon, 3 Jun 2019 21:44:11 +0900 Subject: [PATCH] fix: correct SFINAE conditions and types --- toml/get.hpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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); } }