From e5ad1cd2144cfedf0418a30a125bf057734150f0 Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 21 Feb 2025 19:14:18 +0100 Subject: [PATCH] Do not use no longer supported std::char_traits /usr/bin/../include/c++/v1/string_view:300:42: error: implicit instantiation of undefined template 'std::char_traits' 300 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, | ^ /home/elsid/dev/openmw/components/to_utf8/to_utf8.cpp:55:41: note: in instantiation of template class 'std::basic_string_view' requested here 55 | std::basic_string_view getTranslationArray(FromType sourceEncoding) | ^ /usr/bin/../include/c++/v1/__fwd/string.h:23:29: note: template is declared here 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; | ^ std::char_traits support for non char types was removed from libc++19: https://reviews.llvm.org/D157058. --- components/to_utf8/to_utf8.cpp | 2 +- components/to_utf8/to_utf8.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/to_utf8/to_utf8.cpp b/components/to_utf8/to_utf8.cpp index 15fb8b26c0..7e34147b1c 100644 --- a/components/to_utf8/to_utf8.cpp +++ b/components/to_utf8/to_utf8.cpp @@ -52,7 +52,7 @@ namespace return std::find_if(input.begin(), input.end(), [](unsigned char v) { return v == 0 || v >= 128; }); } - std::basic_string_view getTranslationArray(FromType sourceEncoding) + std::span getTranslationArray(FromType sourceEncoding) { switch (sourceEncoding) { diff --git a/components/to_utf8/to_utf8.hpp b/components/to_utf8/to_utf8.hpp index 80af6586c9..0dde0fced6 100644 --- a/components/to_utf8/to_utf8.hpp +++ b/components/to_utf8/to_utf8.hpp @@ -2,6 +2,7 @@ #define COMPONENTS_TOUTF8_H #include +#include #include #include #include @@ -50,7 +51,7 @@ namespace ToUTF8 inline void copyFromArrayLegacyEnc( std::string_view::iterator& chp, std::string_view::iterator end, char*& out) const; - const std::basic_string_view mTranslationArray; + const std::span mTranslationArray; }; class Utf8Encoder