Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarLexicalCast.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-09-22 16:24:20 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-09-22 16:24:20 +1000
commit3e8f914154b06af319ea7fffa633e0501f0e1f62 (patch)
treeeefcb2f922c46214e88bd9c6de2c5f0736cc45b7 /source/core/StarLexicalCast.hpp
parentca48a137ec25f1002af4a1ab6e6e5047b5684ca6 (diff)
fix bool lexical casts
oops
Diffstat (limited to 'source/core/StarLexicalCast.hpp')
-rw-r--r--source/core/StarLexicalCast.hpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/core/StarLexicalCast.hpp b/source/core/StarLexicalCast.hpp
index 13c0521..15afe3f 100644
--- a/source/core/StarLexicalCast.hpp
+++ b/source/core/StarLexicalCast.hpp
@@ -19,6 +19,9 @@ bool tryLexicalCast(Type& result, const char* first, const char* last) {
return res.ptr == last && (res.ec == std::errc() || res.ec == std::errc::result_out_of_range);
}
+template <>
+bool tryLexicalCast(bool& result, const char* first, const char* last);
+
template <typename Type>
bool tryLexicalCast(Type& result, String const& s) {
return tryLexicalCast<Type>(s.utf8Ptr(), s.utf8Ptr() + s.utf8Size());
@@ -43,7 +46,6 @@ Maybe<Type> maybeLexicalCast(StringView s) {
return maybeLexicalCast<Type>(s.utf8Ptr(), s.utf8Ptr() + s.utf8Size());
}
-
template <typename Type>
Type lexicalCast(const char* first, const char* last) {
Type result{};
@@ -54,6 +56,9 @@ Type lexicalCast(const char* first, const char* last) {
return result;
}
+template <>
+bool lexicalCast(const char* first, const char* last);
+
template <typename Type>
Type lexicalCast(StringView s) {
return lexicalCast<Type>(s.utf8Ptr(), s.utf8Ptr() + s.utf8Size());