1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

AK: Mark smart pointer classes as [[nodiscard]]

This makes it an error to not do something with a returned smart
pointer, which should help prevent mistakes. In cases where you do need
to ignore the value, casting to void will placate the compiler.

I did have to add comments to disable clang-format on a couple of lines,
where it wanted to format the code like this:

```c++
private : NonnullRefPtr() = delete;
```
This commit is contained in:
Sam Atkins 2021-12-01 21:05:13 +00:00 committed by Andreas Kling
parent 3ca2aee054
commit 5013a6480d
5 changed files with 8 additions and 5 deletions

View file

@ -27,7 +27,7 @@ template<typename T>
class OwnPtr;
template<typename T, typename PtrTraits>
class RefPtr {
class [[nodiscard]] RefPtr {
template<typename U, typename P>
friend class RefPtr;
template<typename U>