Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ jobs:
- compiler: gcc
compiler-version: 12
cxx: 23
- compiler: gcc
compiler-version: 13
cxx: 23
- compiler: llvm
compiler-version: 16
cxx: 23
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "macos-13"]
os: ["macos-latest", "macos-15-intel"]
format: ["tests", "benchmarks"]
name: "${{ matrix.os }} (${{ matrix.format }})"
concurrency:
Expand Down
26 changes: 18 additions & 8 deletions include/rfl/Result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ namespace rfl {
/// Defines the error class to be returned when something went wrong
class Error {
public:
Error() = default;

Error(const std::string& _what) : what_(_what) {}
Error(std::string&& _what) : what_(std::move(_what)) {}

~Error() = default;

Error(const Error& e) = default;
Error(Error&& e) = default;
Error(Error&& e) noexcept = default;

Error& operator=(const Error&) = default;
Error& operator=(Error&&) = default;
Error& operator=(const Error& _other) = default;

Error& operator=(Error&& _other) noexcept = default;

/// Returns the error message, equivalent to .what() in std::exception.
const std::string& what() const& { return what_; }
Expand Down Expand Up @@ -450,17 +455,22 @@ template <>
class std::bad_expected_access<rfl::Error> : public bad_expected_access<void> {
public:
explicit constexpr bad_expected_access(rfl::Error er) : err_(std::move(er)) {}

const char* what() const noexcept override { return err_.what().c_str(); }

template <typename Self>
[[nodiscard]]
auto error(this Self&& self) noexcept {
return std::forward<Self>(self).err_;
[[nodiscard]] rfl::Error& error() & noexcept { return err_; }

[[nodiscard]] const rfl::Error& error() const& noexcept { return err_; }

[[nodiscard]] rfl::Error&& error() && noexcept { return std::move(err_); }

[[nodiscard]] const rfl::Error&& error() const&& noexcept {
return std::move(err_);
}

private:
rfl::Error err_;
};
#endif

#endif
#endif
2 changes: 1 addition & 1 deletion include/rfl/parsing/Parser_unique_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct Parser<R, W, std::unique_ptr<T>, ProcessorsType> {
}
return Parser<R, W, std::remove_cvref_t<T>, ProcessorsType>::read(_r,
_var)
.transform([](T&& _t) { return std::make_unique<T>(std::move(_t)); });
.transform([](T _t) { return std::make_unique<T>(std::move(_t)); });
}
}

Expand Down
2 changes: 1 addition & 1 deletion include/rfl/parsing/Parser_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class Parser<R, W, std::variant<AlternativeTypes...>, ProcessorsType> {
if (res) {
_result->emplace(std::move(*res));
} else {
_errors->emplace_back(std::move(res.error()));
_errors->emplace_back(res.error());
}
}
}
Expand Down
Loading