1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:27:35 +00:00

AK: Ensure string types are actually considered hash-compatible

The AnyString concept is currently broken because it checks whether a
StringView is constructible from a type T. The StringView constructors,
however, only accept constant rvalue references - i.e. `T const&`.

This also adds a test to ensure this continues to work.
This commit is contained in:
Timothy Flynn 2023-02-02 10:48:11 -05:00 committed by Linus Groh
parent 2f67f2ba3d
commit f31bd190b0
2 changed files with 25 additions and 1 deletions

View file

@ -49,7 +49,7 @@ template<typename T, typename S>
concept DerivedFrom = IsBaseOf<S, T>;
template<typename T>
concept AnyString = IsConstructible<StringView, T>;
concept AnyString = IsConstructible<StringView, RemoveCVReference<T> const&>;
template<typename T, typename U>
concept HashCompatible = IsHashCompatible<Detail::Decay<T>, Detail::Decay<U>>;