summaryrefslogtreecommitdiff
path: root/AK/OwnPtr.h
AgeCommit message (Collapse)Author
2019-08-14AK: Use int_hash() to generate less idiotic hashes for {Nonnull,}OwnPtrAndreas Kling
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-14OwnPtr: Add a way to turn an OwnPtr into a NonnullOwnPtrAndreas Kling
Okay, so, OwnPtr<T>::release_nonnull() returns a NonnullOwnPtr<T>. It assumes that the OwnPtr is non-null to begin with. Note that this removes the value from the OwnPtr, as there can only be a single owner.
2019-08-02AK: Add assertions when dereferencing an OwnPtr.Andreas Kling
This will make it immediately obvious what the problem is when you're dereferencing a null OwnPtr.
2019-08-01AK: Don't allow constructing an OwnPtr from a const NonnullOwnPtr&Andreas Kling
OwnPtr's must move around, they can't be copy constructed.
2019-07-24AK: Add NonnullOwnPtr.Andreas Kling
This is just like OwnPtr (also single-owner), except it cannot be null. NonnullOwnPtr is perfect as the return type of functions that never need to return nullptr. It's also useful as an argument type to encode the fact that the argument must not be nullptr. The make<Foo>() helper is changed to return NonnullOwnPtr<Foo>. Note: You can move() out of a NonnullOwnPtr, and after that the object is in an invalid state. Internally it will be a nullptr at this point, so we'll still catch misuse, but the only thing that should be done in this state is running the destructor. I've used consumable annotations to generate some warnings when using a NonnullOwnPtr after moving from it, but these only work when compiling with clang, so be aware of that.
2019-07-11AK: Delete bad pointer assignment operators and constructors.Andreas Kling
We shouldn't allow constructing e.g an OwnPtr from a RefPtr, and similar conversions. Instead just delete those functions so the compiler whines loudly if you try to use them. This patch also deletes constructing OwnPtr from a WeakPtr, even though that *may* be a valid thing to do, it's sufficiently weird that we can make the client jump through some hoops if he really wants it. :^)
2019-07-04AK: Move some of LogStream out of line & add overloads for smart pointers.Andreas Kling
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-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-04-14AK: Improve smart pointer ergonomics a bit.Andreas Kling
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2018-12-05Support inserting a newline.Andreas Kling
2018-12-04Import a simple text editor I started working on.Andreas Kling
2018-10-26Implement /proc/PID/vm.Andreas Kling
Refactored SyntheticFileSystem to maintain an arbitrary directory structure. ProcFileSystem creates a directory entry in /proc for each new process.
2018-10-16Merge some features from gerbert into OwnPtr and RetainPtr.Andreas Kling
2018-10-10Import all this stuff into a single repo called Serenity.Andreas Kling