From 0f7a89ab992f9c3f3012c4dd50f9f10f31135fee Mon Sep 17 00:00:00 2001 From: sean Date: Sun, 2 Jun 2024 11:11:56 +0200 Subject: [PATCH] Fix: Mark Expected functions as nodiscard --- include/fastgltf/core.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/fastgltf/core.hpp b/include/fastgltf/core.hpp index 90c02f6ba..df3866b5d 100644 --- a/include/fastgltf/core.hpp +++ b/include/fastgltf/core.hpp @@ -538,13 +538,13 @@ namespace fastgltf { } template - auto& get() noexcept { + [[nodiscard]] auto& get() noexcept { if constexpr (I == 0) return err; else if constexpr (I == 1) return value; } template - const auto& get() const noexcept { + [[nodiscard]] const auto& get() const noexcept { if constexpr (I == 0) return err; else if constexpr (I == 1) return value; } @@ -553,7 +553,7 @@ namespace fastgltf { * Returns the address of the value of T. * When error() returns anything but Error::None, the returned value is undefined. */ - T* operator->() noexcept { + [[nodiscard]] T* operator->() noexcept { assert(err == Error::None); return std::addressof(value); } @@ -562,17 +562,17 @@ namespace fastgltf { * Returns the address of the const value of T. * When error() returns anything but Error::None, the returned value is undefined. */ - const T* operator->() const noexcept { + [[nodiscard]] const T* operator->() const noexcept { assert(err == Error::None); return std::addressof(value); } - T&& operator*() && noexcept { + [[nodiscard]] T&& operator*() && noexcept { assert(err == Error::None); return std::move(value); } - operator bool() const noexcept { + [[nodiscard]] operator bool() const noexcept { return err == Error::None; } };