From c06f753d5cf1531c41f0724bb6d4b24d28cec6aa Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 29 Sep 2024 14:28:34 -0400 Subject: Try to eliminate the runtime cost of `ll_convert_to(const T&)`. --- indra/llcommon/llstring.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index b552aede82..c56ef9fb59 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -550,7 +550,13 @@ private: public: ll_convert(const FROM& ref): mRef(ref) {} - template + inline operator const FROM&() const + { + return mRef; + } + + template , std::decay_t>, bool> =true> inline operator TO() const { return ll_convert_impl>()(mRef); @@ -559,7 +565,15 @@ public: // When the TO type must be explicit, use a function template to get // ll_convert_to(from_value) API. -template +template +const SAME& ll_convert_to(const SAME& in) +{ + return in; +} + +template, std::decay_t>, bool> =true> TO ll_convert_to(const FROM& in) { return ll_convert_impl>()(in); -- cgit v1.2.3 From c7e9c5d1336cabd550e0c839d3e0465565638574 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 29 Sep 2024 14:36:38 -0400 Subject: Zap trailing spaces. --- indra/llcommon/llstring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index c56ef9fb59..d65fb16f5b 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -569,7 +569,7 @@ template const SAME& ll_convert_to(const SAME& in) { return in; -} +} template