From 2eaa2875f0f2523439beb623fc63146ef295c8cc Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 9 Oct 2024 17:28:35 -0500 Subject: Use const references and constexpr as applicable. --- include/fud_result.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'include/fud_result.hpp') diff --git a/include/fud_result.hpp b/include/fud_result.hpp index 74954df..dae084a 100644 --- a/include/fud_result.hpp +++ b/include/fud_result.hpp @@ -18,7 +18,6 @@ #ifndef FUD_RESULT_HPP #define FUD_RESULT_HPP -#include #include namespace fud { @@ -58,22 +57,22 @@ class [[nodiscard]] Result { return (m_value.index() == 1); } - [[nodiscard]] T getOkay() const + [[nodiscard]] const T& getOkay() const& { return std::get(m_value); } - [[nodiscard]] E getError() const + [[nodiscard]] const E& getError() const& { return std::get(m_value); } - [[nodiscard]] T&& getOkay() + [[nodiscard]] const T&& getOkay() const&& { return std::move(std::get(m_value)); } - [[nodiscard]] E&& getError() + [[nodiscard]] const E&& getError() const&& { return std::move(std::get(m_value)); } @@ -91,7 +90,7 @@ class [[nodiscard]] Result { { } - explicit Result(T&& value) : m_value{std::move(value)} + explicit Result(T&& value): m_value{std::move(value)} { } -- cgit v1.2.3