diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-10-04 10:04:13 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-10-04 10:04:13 -0400 |
commit | 14293b7b0a63fe5be904cbdc853f3b185e13f3fc (patch) | |
tree | 6a755ca689fc408de11e46b891fedb52002b6b9f /indra/llcommon/llstring.h | |
parent | 71e89d6a493e51789008f74f87439611f11c13ab (diff) | |
parent | e093a98f86ad46374f5067adb616a2aead73eff5 (diff) |
Merge remote branch 'develop' into marchcat/xcode-16
Diffstat (limited to 'indra/llcommon/llstring.h')
-rw-r--r-- | indra/llcommon/llstring.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index b552aede82..d65fb16f5b 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 <typename TO> + inline operator const FROM&() const + { + return mRef; + } + + template <typename TO, + std::enable_if_t<! std::is_same_v<std::decay_t<TO>, std::decay_t<FROM>>, bool> =true> inline operator TO() const { return ll_convert_impl<TO, std::decay_t<const FROM>>()(mRef); @@ -559,7 +565,15 @@ public: // When the TO type must be explicit, use a function template to get // ll_convert_to<TO>(from_value) API. -template<typename TO, typename FROM> +template<typename SAME> +const SAME& ll_convert_to(const SAME& in) +{ + return in; +} + +template<typename TO, + typename FROM, + std::enable_if_t<! std::is_same_v<std::decay_t<TO>, std::decay_t<FROM>>, bool> =true> TO ll_convert_to(const FROM& in) { return ll_convert_impl<TO, std::decay_t<const FROM>>()(in); |