aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-03-17 22:31:40 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-03-17 22:31:40 +0100
commit044a64ef019ce2ff241e72f2b7b3a444b922b798 (patch)
tree3cf9db1f64102e2fd748ba22ef3f79f96a48f66f /libs
parent9ad3eafdfa46dc01d7a8737a59fe59caffd91d67 (diff)
downloadteachos-044a64ef019ce2ff241e72f2b7b3a444b922b798.tar.xz
teachos-044a64ef019ce2ff241e72f2b7b3a444b922b798.zip
kstd: add more nodiscard to shared_ptr
Diffstat (limited to 'libs')
-rw-r--r--libs/kstd/include/kstd/bits/shared_ptr.hpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/kstd/include/kstd/bits/shared_ptr.hpp b/libs/kstd/include/kstd/bits/shared_ptr.hpp
index ed23d29..6bce83f 100644
--- a/libs/kstd/include/kstd/bits/shared_ptr.hpp
+++ b/libs/kstd/include/kstd/bits/shared_ptr.hpp
@@ -250,7 +250,7 @@ namespace kstd
*
* @return Returns the object owned by *this, equivalent to *get().
*/
- auto operator*() const -> T &
+ [[nodiscard]] auto operator*() const -> T &
{
return *pointer;
}
@@ -260,7 +260,7 @@ namespace kstd
*
* @return Returns a pointer to the object owned by *this, i.e. get().
*/
- auto operator->() const -> T *
+ [[nodiscard]] auto operator->() const -> T *
{
return pointer;
}
@@ -270,7 +270,7 @@ namespace kstd
*
* @return Pointer to the managed object or nullptr if no object is owned.
*/
- auto get() const -> T *
+ [[nodiscard]] auto get() const -> T *
{
return pointer;
}
@@ -301,7 +301,7 @@ namespace kstd
*
* @return true if *this owns an object, false otherwise.
*/
- explicit operator bool() const
+ [[nodiscard]] explicit operator bool() const
{
return pointer != nullptr;
}
@@ -317,7 +317,7 @@ namespace kstd
/**
* @brief Compare nullptr with shared_ptr.
*/
- friend auto operator==(std::nullptr_t, shared_ptr const & ptr) -> bool
+ [[nodiscard]] friend auto operator==(std::nullptr_t, shared_ptr const & ptr) -> bool
{
return ptr.pointer == nullptr;
}
@@ -325,7 +325,7 @@ namespace kstd
/**
* @brief Defaulted three-way comparator operator.
*/
- auto operator<=>(shared_ptr const & other) const = default;
+ [[nodiscard]] auto operator<=>(shared_ptr const & other) const = default;
private:
/**