diff --git a/include/toml11/find.hpp b/include/toml11/find.hpp index e06442e9..560db2a7 100644 --- a/include/toml11/find.hpp +++ b/include/toml11/find.hpp @@ -333,16 +333,14 @@ find_or(const basic_value& v, const K& ky, T opt) namespace detail { -template -T& last_one(T& arg) -{ - return arg; -} -template -auto last_one(T1&, T2& arg, Ts& ... args) -> decltype(last_one(arg, args...)) + +template +auto last_one(Ts&&... args) + -> decltype(std::get(std::forward_as_tuple(std::forward(args)...))) { - return last_one(arg, args...); + return std::get(std::forward_as_tuple(std::forward(args)...)); } + } // detail template