Use requires-clauses

Change-Id: I27c990f27023aba5e77c6b406d7dbdcc898054ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158405
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2023-10-24 22:46:25 +02:00
parent 4ec29bf35e
commit 3d58f3c0c2
+2 -2
View File
@@ -229,12 +229,12 @@ sal_Int32 compare(S1 s1, S2 s2, Compare, Shorten_t shortenedLength)
}
// take advantage of builtin optimisations
template <typename C, std::enable_if_t<sizeof(C) == sizeof(wchar_t), int> = 0>
template <typename C> requires (sizeof(C) == sizeof(wchar_t))
sal_Int32 compare(null_terminated<C> s1, null_terminated<C> s2, CompareNormal, NoShortening)
{
return wcscmp(reinterpret_cast<wchar_t const*>(s1.p), reinterpret_cast<wchar_t const*>(s2.p));
}
template <typename C, std::enable_if_t<sizeof(C) == sizeof(char), int> = 0>
template <typename C> requires (sizeof(C) == sizeof(char))
sal_Int32 compare(null_terminated<C> s1, null_terminated<C> s2, CompareNormal, NoShortening)
{
return strcmp(reinterpret_cast<char const*>(s1.p), reinterpret_cast<char const*>(s2.p));