debug/assert: add warn_return

This commit is contained in:
Danny Robson 2020-09-10 15:08:10 +10:00
parent aa1d35cdf6
commit ca192ef4d8

View File

@ -13,6 +13,8 @@
//#include "maths.hpp" // XXX: See notes at the end of file for maths.hpp inclusion
#include "debugger.hpp"
#include <utility>
///////////////////////////////////////////////////////////////////////////////
// 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 <typename ValueT>
decltype(auto)
warn_return (
char const *message,
ValueT &&value
) {
warn (message);
return std::forward<ValueT> (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