mirror of
https://github.com/RGBCube/serenity
synced 2026-01-15 13:11:01 +00:00
There was a small mishmash of argument order, as seen on the table:
| Traits<T>::equals(U, T) | Traits<T>::equals(T, U)
============= | ======================= | =======================
uses equals() | HashMap | Vector, HashTable
defines equals() | *String[^1] | ByteBuffer
[^1]: String, DeprecatedString, their Fly-type equivalents and KString.
This mostly meant that you couldn't use a StringView for finding a value
in Vector<String>.
I'm changing the order of arguments to make the trait type itself first
(`Traits<T>::equals(T, U)`), as I think it's more expected and makes us
more consistent with the rest of the functions that put the stored type
first (like StringUtils functions and binary_serach). I've also renamed
the variable name "other" in find functions to "entry" to give more
importance to the value.
With this change, each of the following lines will now compile
successfully:
Vector<String>().contains_slow("WHF!"sv);
HashTable<String>().contains("WHF!"sv);
HashMap<ByteBuffer, int>().contains("WHF!"sv.bytes());
|
||
|---|---|---|
| .. | ||
| Assertions.h | ||
| DoubleBuffer.cpp | ||
| DoubleBuffer.h | ||
| IOWindow.cpp | ||
| IOWindow.h | ||
| KBuffer.h | ||
| KBufferBuilder.cpp | ||
| KBufferBuilder.h | ||
| KLexicalPath.cpp | ||
| KLexicalPath.h | ||
| KString.cpp | ||
| KString.h | ||
| ListedRefCounted.h | ||
| LockRefPtr.h | ||
| LockWeakable.h | ||
| LockWeakPtr.h | ||
| MiniStdLib.cpp | ||
| NonnullLockRefPtr.h | ||
| Panic.cpp | ||
| Panic.h | ||
| ScopedCritical.cpp | ||
| ScopedCritical.h | ||
| StdLib.cpp | ||
| StdLib.h | ||
| UserOrKernelBuffer.cpp | ||
| UserOrKernelBuffer.h | ||