util/StringCompare: add `constexpr`

This commit is contained in:
Max Kellermann 2024-10-21 13:40:48 +02:00 committed by Max Kellermann
parent 52e2130d51
commit b745d1f226
2 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ StringIsEmpty(const char *string) noexcept
}
[[gnu::pure]]
static inline bool
static constexpr bool
StringIsEqual(std::string_view a, std::string_view b) noexcept
{
return a == b;
@ -112,7 +112,7 @@ const char *
FindStringSuffix(const char *p, const char *suffix) noexcept;
template<typename T>
bool
constexpr bool
SkipPrefix(std::basic_string_view<T> &haystack,
std::basic_string_view<T> needle) noexcept
{
@ -123,7 +123,7 @@ SkipPrefix(std::basic_string_view<T> &haystack,
}
template<typename T>
bool
constexpr bool
RemoveSuffix(std::basic_string_view<T> &haystack,
std::basic_string_view<T> needle) noexcept
{

View File

@ -11,14 +11,14 @@
#include <wchar.h>
[[gnu::pure]] [[gnu::nonnull]]
static inline bool
static constexpr bool
StringIsEmpty(const wchar_t *string) noexcept
{
return *string == 0;
}
[[gnu::pure]]
static inline bool
static constexpr bool
StringIsEqual(std::wstring_view a, std::wstring_view b) noexcept
{
return a == b;