summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/fud_result.hpp11
-rw-r--r--include/fud_status.hpp8
-rw-r--r--include/libfud.hpp4
-rw-r--r--source/fud_string_view.cpp2
4 files changed, 12 insertions, 13 deletions
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 <utility>
#include <variant>
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<T>(m_value);
}
- [[nodiscard]] E getError() const
+ [[nodiscard]] const E& getError() const&
{
return std::get<E>(m_value);
}
- [[nodiscard]] T&& getOkay()
+ [[nodiscard]] const T&& getOkay() const&&
{
return std::move(std::get<T>(m_value));
}
- [[nodiscard]] E&& getError()
+ [[nodiscard]] const E&& getError() const&&
{
return std::move(std::get<E>(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)}
{
}
diff --git a/include/fud_status.hpp b/include/fud_status.hpp
index 6a9d653..f8f7687 100644
--- a/include/fud_status.hpp
+++ b/include/fud_status.hpp
@@ -42,7 +42,7 @@ enum class [[nodiscard]] FudStatus
NotSupported
};
-static inline const char* FudStatusToString(FudStatus status)
+constexpr const char* FudStatusToString(FudStatus status)
{
switch (status) {
case FudStatus::Success:
@@ -86,19 +86,19 @@ static inline const char* FudStatusToString(FudStatus status)
}
}
-static inline bool anyAreNull()
+constexpr bool anyAreNull()
{
return false;
}
template <typename T>
-bool anyAreNull(const T* pointer)
+constexpr bool anyAreNull(const T* pointer)
{
return pointer == nullptr;
}
template <typename T, typename... Ts>
-bool anyAreNull(T pointer, Ts... pointers)
+constexpr bool anyAreNull(T pointer, Ts... pointers)
{
if (pointer == nullptr) {
return true;
diff --git a/include/libfud.hpp b/include/libfud.hpp
index c670ed4..5bc1630 100644
--- a/include/libfud.hpp
+++ b/include/libfud.hpp
@@ -51,8 +51,8 @@ FUD fud();
Result<String, FudStatus> getEnv(const char* name);
template <typename T>
-concept CStringRepr = requires(T a) {
- { a.c_str() } -> std::convertible_to<const char*>;
+concept CStringRepr = requires(T strObj) {
+ { strObj.c_str() } -> std::convertible_to<const char*>;
};
template <CStringRepr T>
diff --git a/source/fud_string_view.cpp b/source/fud_string_view.cpp
index 411f055..23a4671 100644
--- a/source/fud_string_view.cpp
+++ b/source/fud_string_view.cpp
@@ -900,7 +900,7 @@ FudStatus getWhole(
}
template <typename T>
-FudStatus getExponent(const StringView& view, size_t& digitIndex, T& num, uint8_t radix)
+FudStatus getExponent(StringView view, size_t& digitIndex, T& num, uint8_t radix)
{
int32_t exponent{};
StringView tempView{view.length - digitIndex, view.data + digitIndex};