summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-11-15 10:11:30 -0500
committerNat Goodspeed <nat@lindenlab.com>2023-11-15 10:11:30 -0500
commit7670f190827b7d1e1c2a424ec6aa3379cb42ed52 (patch)
treef71eaa38e8246f2f4a04c925b9bb39d910cdd7b8 /indra
parent96deda3f63ca12be734fb02e5f9406744bff3629 (diff)
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.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/stdtypes.h18
1 files changed, 3 insertions, 15 deletions
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 <typename FROM>
-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 <typename TO,
@@ -207,13 +204,4 @@ public:
}
};
-/// narrow() factory function returns a narrow_holder<FROM>(), which can be
-/// implicitly converted to the target type.
-template <typename FROM>
-inline
-narrow_holder<FROM> narrow(FROM value)
-{
- return { value };
-}
-
#endif