From c58ec94e2d07c5d636c1db4a610588f9aceb3953 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 27 Oct 2016 10:48:02 +0200 Subject: [PATCH] Core/Algorithm: Fix return type of Apply() --- include/Nazara/Core/Algorithm.hpp | 4 ++-- include/Nazara/Core/Algorithm.inl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Nazara/Core/Algorithm.hpp b/include/Nazara/Core/Algorithm.hpp index be25f4773..5bb461f26 100644 --- a/include/Nazara/Core/Algorithm.hpp +++ b/include/Nazara/Core/Algorithm.hpp @@ -20,8 +20,8 @@ namespace Nz class AbstractHash; class ByteArray; - template auto Apply(F&& fn, Tuple&& t); - template auto Apply(O& object, F&& fn, Tuple&& t); + template decltype(auto) Apply(F&& fn, Tuple&& t); + template decltype(auto) Apply(O& object, F&& fn, Tuple&& t); template ByteArray ComputeHash(HashType hash, const T& v); template ByteArray ComputeHash(AbstractHash* hash, const T& v); template constexpr std::size_t CountOf(T(&name)[N]) noexcept; diff --git a/include/Nazara/Core/Algorithm.inl b/include/Nazara/Core/Algorithm.inl index 15827144d..b02924446 100644 --- a/include/Nazara/Core/Algorithm.inl +++ b/include/Nazara/Core/Algorithm.inl @@ -19,13 +19,13 @@ namespace Nz { // http://www.cppsamples.com/common-tasks/apply-tuple-to-function.html template - auto ApplyImplFunc(F&& fn, Tuple&& t, std::index_sequence) + decltype(auto) ApplyImplFunc(F&& fn, Tuple&& t, std::index_sequence) { return std::forward(fn)(std::get(std::forward(t))...); } template - auto ApplyImplMethod(O& object, F&& fn, Tuple&& t, std::index_sequence) + decltype(auto) ApplyImplMethod(O& object, F&& fn, Tuple&& t, std::index_sequence) { return (object .* std::forward(fn))(std::get(std::forward(t))...); } @@ -44,7 +44,7 @@ namespace Nz * \see Apply */ template - auto Apply(F&& fn, Tuple&& t) + decltype(auto) Apply(F&& fn, Tuple&& t) { constexpr std::size_t tSize = std::tuple_size::type>::value; @@ -63,7 +63,7 @@ namespace Nz * \see Apply */ template - auto Apply(O& object, F&& fn, Tuple&& t) + decltype(auto) Apply(O& object, F&& fn, Tuple&& t) { constexpr std::size_t tSize = std::tuple_size::type>::value;