From 7670f190827b7d1e1c2a424ec6aa3379cb42ed52 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 Nov 2023 10:11:30 -0500 Subject: SL-20546: Rely on CTAD for 'narrow' class. Now that we're building with C++17, we can use Class Template Argument Deduction to infer the type passed to the constructor of the 'narrow' class. We no longer require a narrow_holder class with a narrow() factory function. --- indra/llcommon/stdtypes.h | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'indra/llcommon/stdtypes.h') diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index 0b43d7ad4b..3aba9dda00 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -156,18 +156,15 @@ typedef int intptr_t; * type. */ // narrow_holder is a struct that accepts the passed value as its original -// type and provides templated conversion functions to other types. Once we're -// building with compilers that support Class Template Argument Deduction, we -// can rename this class template 'narrow' and eliminate the narrow() factory -// function below. +// type and provides templated conversion functions to other types. template -class narrow_holder +class narrow { private: FROM mValue; public: - narrow_holder(FROM value): mValue(value) {} + narrow(FROM value): mValue(value) {} /*---------------------- Narrowing unsigned to signed ----------------------*/ template (), which can be -/// implicitly converted to the target type. -template -inline -narrow_holder narrow(FROM value) -{ - return { value }; -} - #endif -- cgit v1.2.3