diff options
| author | Marcel Braun <marcel.braun@ost.ch> | 2026-03-17 22:44:22 +0100 |
|---|---|---|
| committer | Marcel Braun <marcel.braun@ost.ch> | 2026-03-17 22:44:22 +0100 |
| commit | b3538509091a59cd945ff48509ece5a97c59071d (patch) | |
| tree | c28015a0f74c31a7a27063fa8765b59d5b326c5c /libs | |
| parent | e4291ea7c01cad04a02ca3f577dba9ccbadad110 (diff) | |
| parent | d2e7a4e2fd5a2973b6c9071951eaf8b2d24d84a3 (diff) | |
| download | teachos-b3538509091a59cd945ff48509ece5a97c59071d.tar.xz teachos-b3538509091a59cd945ff48509ece5a97c59071d.zip | |
Merge branch 'fmorgner/lint-fixes' into 'develop-BA-FS26'
lint: fix some issues detected by clang-tidy
See merge request teachos/kernel!13
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/kstd/include/kstd/bits/shared_ptr.hpp | 12 | ||||
| -rw-r--r-- | libs/kstd/include/kstd/vector | 6 |
2 files changed, 9 insertions, 9 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: /** diff --git a/libs/kstd/include/kstd/vector b/libs/kstd/include/kstd/vector index 7568cb6..41b380e 100644 --- a/libs/kstd/include/kstd/vector +++ b/libs/kstd/include/kstd/vector @@ -85,7 +85,7 @@ namespace kstd vector(vector<value_type> const & other) : _size(other._size) , _capacity(other._capacity) - , _data(new value_type[_capacity]{}) + , _data(new value_type[_capacity]()) { std::ranges::copy(other, _data); } @@ -104,7 +104,7 @@ namespace kstd delete[] _data; _size = other._size; _capacity = other._capacity; - _data = new value_type[_capacity]{}; + _data = new value_type[_capacity](); std::ranges::copy(other, _data); return *this; } @@ -490,7 +490,7 @@ namespace kstd } _capacity = new_capacity; - auto temp = new value_type[_capacity]{}; + auto temp = new value_type[_capacity](); std::ranges::copy(begin(), end(), temp); delete[] _data; _data = temp; |
