1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:37:34 +00:00
serenity/Kernel/Library
Karol Kosek e575ee4462 AK+Kernel: Unify Traits<T>::equals()'s argument order on different types
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());
2023-08-23 20:21:09 +02:00
..
Assertions.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
DoubleBuffer.cpp Kernel: Move InterruptDisabler to the Interrupts subdirectory 2023-06-04 21:32:34 +02:00
DoubleBuffer.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
IOWindow.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
IOWindow.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
KBuffer.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
KBufferBuilder.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
KBufferBuilder.h Kernel: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes in default impls 2023-06-18 08:47:51 +01:00
KLexicalPath.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
KLexicalPath.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
KString.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
KString.h AK+Kernel: Unify Traits<T>::equals()'s argument order on different types 2023-08-23 20:21:09 +02:00
ListedRefCounted.h AK+Kernel: Add AK::AtomicRefCounted and use everywhere in the kernel 2022-08-20 17:15:52 +02:00
LockRefPtr.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
LockWeakable.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
LockWeakPtr.h Kernel: Switch LockRefPtr<Inode> to RefPtr<Inode> 2023-03-09 21:54:59 +01:00
MiniStdLib.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
NonnullLockRefPtr.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
Panic.cpp Kernel: Move all boot-related code to the new Boot subdirectory 2023-06-04 21:32:34 +02:00
Panic.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
ScopedCritical.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
ScopedCritical.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
StdLib.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
StdLib.h AK+Kernel: Add the FixedStringBuffer class and StdLib functions for it 2023-08-09 21:06:54 -06:00
UserOrKernelBuffer.cpp Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00
UserOrKernelBuffer.h Everywhere: Move global Kernel pattern code to Kernel/Library directory 2023-06-04 21:32:34 +02:00