summaryrefslogtreecommitdiff
path: root/AK/Traits.h
AgeCommit message (Collapse)Author
2022-04-10AK: Add missing include to Traits.hAndreas Kling
2022-04-10AK: Add hash traits for floating-point primitivesAndreas Kling
This allows us to use float and double as hash keys.
2022-04-04AK: Return Optional<T&> from HashMap<..., T>::get()Ali Mohammad Pur
This avoids a useless copy of the value, as most of the users (except one) actually just need a reference to the value.
2022-01-29AK: Support using custom comparison operations for hash compatible keysIdan Horowitz
2021-12-15AK: Add dedicated Traits for c-stringsHendiadyoin1
2021-08-27AK: Add Traits for Enumskleines Filmröllchen
Enums can be hashed as their underlying integral type. This allows enum keys in hash maps etc.
2021-07-12AK: Make Traits<T*> use ptr_hash() and not assume 32-bit pointersAli Mohammad Pur
As a nice bonus, it also simplifies the code quite a bit.
2021-07-12AK: Replace all explicit specialisations of Traits with a single oneAli Mohammad Pur
This commit un-confuses the many specialisations of AK::Traits, and makes it work correctly for all integral types. Prior to this, `AK::Traits<size_t>` would've been instantiating the base Traits implementation, not `Traits<u32>` or `Traits<u64>`.
2021-05-08AK: Add ConstPeekType to TraitsItamar
Also, the PeekType of smart pointers is now T* instead of const T*. Note: This commit doesn't compile, it breaks HashMap::get() for some types. Fixed in the next commit.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-01-11AK: Find a value in any container offering iteratorsLenny Maiorani
Problem: - `find` is implemented inside of each container. This coupling requires that each container needs to individually provide `find`. Solution: - Decouple the `find` functionality from the container. This allows provides a `find` algorithm which can work with all containers. Containers can still provide their own `find` in the case where it can be optimized. - This also allows for searching sub-ranges of a container rather than the entire container as some of the container-specific member functions enforced. Note: - @davidstone's talk from 2015 C++Now conference entitled "Functions Want to be Free" encourages this style: (https://www.youtube.com/watch?v=_lVlC0xzXDc), but it does come at the cost of composability. - A logical follow-on to this is to provide a mechanism to use a short-hand function which automatically searches the entire container. This could automatically use the container-provided version if available so that functions which provide their own optimized version get the benefit.
2020-12-19AK: Add hash implementations for i16 and i64Sahan Fernando
2020-11-29AK: Add missing GenericTraits<u8>devashish
This enables us to use keys of type u8 in HashMaps.
2020-02-16AK: Add HashMap, HashTable and Traits to Forward.hAndreas Kling
2020-02-10AK: Remove bitrotted Traits::dump() mechanismAndreas Kling
This was only used by HashTable::dump() which I used when doing the first HashTable implementation. Removing this allows us to also remove most includes of <AK/kstdio.h>.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-05AK: Add a u64 Trait typeShannon Booth
This allows u64s to be used in HashMaps.
2019-08-14AK: Make it possible to use HashMap<K, NonnullOwnPtr>::get()Andreas Kling
Add the concept of a PeekType to Traits<T>. This is the type we'll return (wrapped in an Optional) from HashMap::get(). The PeekType for OwnPtr<T> and NonnullOwnPtr<T> is const T*, which means that HashMap::get() will return an Optional<const T*> for maps-of-those.
2019-08-07Vector: Use memcmp for comparing two vectors with trivial elementsAndreas Kling
2019-08-07Vector: Use memmove() for moving trivial types around moreAndreas Kling
This can definitely be improved with better trivial type detection and by using the TypedTransfer template in more places. It's a bit annoying that we can't get <type_traits> in Vector.h since it's included in the toolchain compilation before we have libstdc++.
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-06-29AK: Defer to Traits<T> for equality comparison in container templates.Andreas Kling
This is prep work for supporting HashMap with NonnullRefPtr<T> as values. It's currently not possible because many HashTable functions require being able to default-construct the value type.
2019-06-22LibHTML: Make it possible to build LibHTML on the host.Andreas Kling
- "make" builds the normal Serenity libhtml.a - "make -f Makefile.host" builds a test program for the host machine.
2019-05-28Add clang-format fileRobin Burchell
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
2019-03-13IPv4: Dynamically allocate the UDP source port if needed.Andreas Kling
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2019-01-17Get rid of #ifdef SERENITY. We're past that phase of bootstrapping.Andreas Kling
2018-10-29Fix broken SpinLock.Andreas Kling
The SpinLock was all backwards and didn't actually work. Fixing it exposed how wrong most of the locking here is. I need to come up with a better granularity here.
2018-10-27Better int hashing. This was going to bite me sooner or later.Andreas Kling
2018-10-17Integrate ext2 from VFS into Kernel.Andreas Kling
2018-10-11Support arbitrary pointer traits.Andreas Kling
2018-10-10Import all this stuff into a single repo called Serenity.Andreas Kling