summaryrefslogtreecommitdiff
path: root/AK/SinglyLinkedList.h
AgeCommit message (Collapse)Author
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-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-31SinglyLinkedList: Correctly pass args to append, insert_before, insert_afterLenny Maiorani
Problem: - Using regular functions rather than function templates results in the arguments not being deduced. This then requires the same function to be written multiple times and for `move` to be used rather than `forward`. Solution: - Collapse multiple function overloads to a single function template with a deduced argument. This allows the argument to be a forwarding reference and bind to either an l-value or r-value and forward the value.
2021-01-12AK: Simplify constructors and conversions from nullptr_tLenny Maiorani
Problem: - Many constructors are defined as `{}` rather than using the ` = default` compiler-provided constructor. - Some types provide an implicit conversion operator from `nullptr_t` instead of requiring the caller to default construct. This violates the C++ Core Guidelines suggestion to declare single-argument constructors explicit (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit). Solution: - Change default constructors to use the compiler-provided default constructor. - Remove implicit conversion operators from `nullptr_t` and change usage to enforce type consistency without conversion.
2021-01-11SinglyLinkedList: Implement `find` in terms of `AK::find`Lenny Maiorani
Problem: - The implementation of `find` is coupled to the implementation of `SinglyLinkedList`. Solution: - Decouple the implementation of `find` from the class by using a generic `find` algorithm.
2020-09-06AK: SinglyLinkedList use Traits<T>::equals in findMuhammad Zahalqa
Use Traits<T>::equals for equality checking in search functions instead of operator==
2020-04-27AK: Add SinglyLinkedListIterator::is_begin()Brian Gianforcaro
It's useful to be able to tell if we are at the beginning of the list when using the list as a queue.
2020-03-08AK: Move memory stuff (fast memcpy, etc) to a separate headerAndreas Kling
Move the "fast memcpy" stuff out of StdLibExtras.h and into Memory.h. This will break a ton of things that were relying on StdLibExtras.h to include a bunch of other headers. Fix will follow immediately after. This makes it possible to include StdLibExtras.h from Types.h, which is the main point of this exercise.
2020-02-27AK: Expose SinglyLinkedListIterator constructorWilliam McPherson
This commit replaces SinglyLinkedListIterator::universal_end() with an empty SinglyLinkedListIterator(). Piano needs this in order to initialize a member array of iterators without 84 lines of universal_end().
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.
2019-12-27AK: Fix unused parameter bug in SinglyLinkedList (#928)Valtteri Koskivuori
2019-12-27AK: Simplify const T& versions of append/insert in SinglyLinkedListConrad Pankoff
2019-12-27AK: Add insert_{before,after}(iterator, value) to SinglyLinkedListConrad Pankoff
2019-12-09AK: SinglyLinkedList::size_slow() should return size_tAndreas Kling
2019-07-08AK: Add some missing includes in SinglyLinkedList.Andreas Kling
2019-06-29AK: Allow HashMap to be used with non-default-constructible values.Andreas Kling
Solve this by adding find() overloads to HashTable and SinglyLinkedList that take a templated functor for comparing the values. This allows HashMap to call HashTable::find() without having to create a temporary Entry for use as the table key. :^)
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-27AK: Use a SinglyLinkedList<T> as HashTable's bucket chain storage.Andreas Kling
We were using a DoublyLinkedList<T> simply because it supported remove(). This patch consolidates the SinglyLinkedList iterators and adds remove().
2019-06-15AK: Add a simple Queue<T> class.Andreas Kling
The underlying data structure is a singly-linked list of Vector<T>. We never shift any of the vector contents around, but we batch the memory allocations into 1000-element segments.
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-13AK: Fix node leak in SinglyLinkedList::take_first().Andreas Kling
2019-03-11Kernel: Add a NetworkTask and a received network packet queue.Andreas Kling
It will be easier to deal with incoming packets in a separate task.
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2019-01-19Coding style fixes in AK.Andreas Kling
2018-12-21Yet another pass of style fixes.Andreas Kling
2018-10-13Make SinglyLinkedList destruction actually work.Andreas Kling
2018-10-10Import all this stuff into a single repo called Serenity.Andreas Kling