summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-04-03 11:07:36 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-04-03 11:07:36 -0400
commit3b25bc10febc84f10348715dabc9590458923c0b (patch)
tree4ae1e4aacf9f89198186b89ba4184ad6af5aa236 /indra/llcommon/llstring.h
parent7049485ebd0b997a097c12e094425d58db56e043 (diff)
Make ll_convert() and ll_convert_to() use std::decay_t on arg type.
Among other things, this empowers ll_convert() and ll_convert_to() to accept a string literal (which might contain non-ASCII characters, e.g. __FILE__). Without this, even though we have ll_convert_impl specializations accepting const char*, passing a string literal fails because the compiler can't find a specialization specifically accepting const char[length].
Diffstat (limited to 'indra/llcommon/llstring.h')
-rw-r--r--indra/llcommon/llstring.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 0eb2770004..14aa51cb4a 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -37,6 +37,7 @@
#include <algorithm>
#include <vector>
#include <map>
+#include <type_traits>
#include "llformat.h"
#include "stdtypes.h"
@@ -542,7 +543,7 @@ public:
template <typename TO>
inline operator TO() const
{
- return ll_convert_impl<TO, FROM>()(mRef);
+ return ll_convert_impl<TO, std::decay_t<const FROM>>()(mRef);
}
};
@@ -551,7 +552,7 @@ public:
template<typename TO, typename FROM>
TO ll_convert_to(const FROM& in)
{
- return ll_convert_impl<TO, FROM>()(in);
+ return ll_convert_impl<TO, std::decay_t<const FROM>>()(in);
}
// degenerate case