From c0977cbc0a76948c45f67d5667c9fd4fbd70dadd Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Tue, 17 Oct 2023 03:26:43 +0100 Subject: [PATCH] [*] Improved AuMin/AuMax - New prototype: constexpr Ret_t AuMin(const A &a, const B &b) [+] AuCommonType_t --- Include/auROXTL/auNumberUtils.hpp | 10 ++-- Include/auROXTL/auTemplateMeta.hpp | 76 +++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/Include/auROXTL/auNumberUtils.hpp b/Include/auROXTL/auNumberUtils.hpp index d1a735b..0ea5663 100644 --- a/Include/auROXTL/auNumberUtils.hpp +++ b/Include/auROXTL/auNumberUtils.hpp @@ -7,14 +7,16 @@ ***/ #pragma once -template -constexpr const T &AuMin(const T &a, const T &b) +template , A, AuCommonType_t>> +constexpr Ret_t AuMin(const A &a, const B &b) { return a < b ? a : b; } -template -constexpr const T &AuMax(const T &a, const T &b) +template , A, AuCommonType_t>> +constexpr Ret_t AuMax(const A &a, const B &b) { return a < b ? b : a; } diff --git a/Include/auROXTL/auTemplateMeta.hpp b/Include/auROXTL/auTemplateMeta.hpp index 78ea28b..c36fd4d 100644 --- a/Include/auROXTL/auTemplateMeta.hpp +++ b/Include/auROXTL/auTemplateMeta.hpp @@ -78,7 +78,7 @@ namespace _audetail AuFalseType TestIsPtrConvertible(const volatile void *); template - auto TestIsBaseOf(...)->AuTrueType; + auto TestIsBaseOf(...) -> AuTrueType; template auto TestIsBaseOf(int) -> decltype(TestIsPtrConvertible(static_cast(nullptr))); @@ -361,6 +361,12 @@ using AuDecay_t = AuConditional_t< > >; +template +struct AuDecay +{ + using type = AuDecay_t; +}; + template