From 62ea46321d5fe93f4f52a96a27a836ae7bda75f3 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sun, 6 Dec 2020 06:44:33 +0100 Subject: [PATCH] Update function2 --- src/f2/function2.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/f2/function2.hpp b/src/f2/function2.hpp index dc81c7d..4ba16d0 100644 --- a/src/f2/function2.hpp +++ b/src/f2/function2.hpp @@ -1,5 +1,5 @@ -// Copyright 2015-2019 Denis Blank +// Copyright 2015-2020 Denis Blank // Distributed under the Boost Software License, Version 1.0 // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -990,13 +990,13 @@ public: /// Invoke the function at the given index template - constexpr auto invoke(Args&&... args) const { + constexpr decltype(auto) invoke(Args&&... args) const { auto thunk = invoke_table_t::template fetch(vtable_); return thunk(std::forward(args)...); } /// Invoke the function at the given index template - constexpr auto invoke(Args&&... args) const volatile { + constexpr decltype(auto) invoke(Args&&... args) const volatile { auto thunk = invoke_table_t::template fetch(vtable_); return thunk(std::forward(args)...); } @@ -1208,7 +1208,7 @@ public: /// We define this out of class to be able to forward the qualified /// erasure correctly. template - static constexpr auto invoke(Erasure&& erasure, Args&&... args) { + static constexpr decltype(auto) invoke(Erasure&& erasure, Args&&... args) { auto const capacity = erasure.capacity(); return erasure.vtable_.template invoke( std::forward(erasure).opaque_ptr(), capacity, @@ -1324,7 +1324,7 @@ public: } template - static constexpr auto invoke(Erasure&& erasure, T&&... args) { + static constexpr decltype(auto) invoke(Erasure&& erasure, T&&... args) { auto thunk = invoke_table_t::template fetch(erasure.invoke_table_); return thunk(&(erasure.view_), 0UL, std::forward(args)...); } @@ -1761,4 +1761,3 @@ constexpr auto overload(T&&... callables) { #undef FU2_DETAIL_TRAP #endif // FU2_INCLUDED_FUNCTION2_HPP_ -