From ca192ef4d8cdb08130ac460c5a85f8fb013ad5fd Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 10 Sep 2020 15:08:10 +1000 Subject: [PATCH] debug/assert: add warn_return --- debug/assert.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debug/assert.hpp b/debug/assert.hpp index 2f12a41e..80a51bc3 100644 --- a/debug/assert.hpp +++ b/debug/assert.hpp @@ -13,6 +13,8 @@ //#include "maths.hpp" // XXX: See notes at the end of file for maths.hpp inclusion #include "debugger.hpp" +#include + /////////////////////////////////////////////////////////////////////////////// // it is fractionally easier to define a constexpr variable which can be used @@ -389,6 +391,17 @@ void warn (std::string_view); void warn (const char *); +template +decltype(auto) +warn_return ( + char const *message, + ValueT &&value +) { + warn (message); + return std::forward (value); +} + + /////////////////////////////////////////////////////////////////////////////// // XXX: maths needs to be included so that CHECK_EQ/NEQ can call almost_equal, // but maths.hpp might be using CHECK_ macros so we must include maths.hpp