Use cstring_view in utf conversion functions
MODIFY
include/vcpkg_Strings.h
include/vcpkg_Strings.h
@@ -99,9 +99,9 @@ namespace vcpkg::Strings
return details::wformat_internal(fmtstr, to_wprintf_arg(to_wprintf_arg(args))...);
}
- std::wstring utf8_to_utf16(const std::string& s);
+ std::wstring utf8_to_utf16(const cstring_view s);
- std::string utf16_to_utf8(const std::wstring& w);
+ std::string utf16_to_utf8(const cwstring_view w);
std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern);

MODIFY
src/vcpkg_Strings.cpp
src/vcpkg_Strings.cpp
@@ -50,13 +50,13 @@ namespace vcpkg::Strings::details
namespace vcpkg::Strings
{
- std::wstring utf8_to_utf16(const std::string& s)
+ std::wstring utf8_to_utf16(const cstring_view s)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> conversion;
return conversion.from_bytes(s);
}
- std::string utf16_to_utf8(const std::wstring& w)
+ std::string utf16_to_utf8(const cwstring_view w)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> conversion;
return conversion.to_bytes(w);

Use cstring_view in utf conversion functions