Change all decay to remove_cvref.

This commit is contained in:
hazby2002
2023-12-29 17:05:16 +08:00
parent 38783b8907
commit 2d45ddfdc8
62 changed files with 409 additions and 394 deletions
+4 -5
View File
@@ -79,7 +79,7 @@ class Result {
const auto handle_variant =
[&]<class TOrError>(TOrError&& _t_or_err) -> Result_U {
if constexpr (!std::is_same<std::decay_t<TOrError>, Error>()) {
if constexpr (!std::is_same<std::remove_cvref_t<TOrError>, Error>()) {
return _f(std::forward<TOrError>(_t_or_err));
} else {
return std::forward<TOrError>(_t_or_err);
@@ -212,7 +212,7 @@ class Result {
Result<T> or_else(const F& _f) {
const auto handle_variant =
[&]<class TOrError>(TOrError&& _t_or_err) -> Result<T> {
if constexpr (std::is_same<std::decay_t<TOrError>, Error>()) {
if constexpr (std::is_same<std::remove_cvref_t<TOrError>, Error>()) {
return _f(std::forward<Error>(_t_or_err));
} else {
return std::forward<T>(_t_or_err);
@@ -252,7 +252,7 @@ class Result {
const auto handle_variant =
[&]<class TOrError>(TOrError&& _t_or_err) -> rfl::Result<U> {
if constexpr (!std::is_same<std::decay_t<TOrError>, Error>()) {
if constexpr (!std::is_same<std::remove_cvref_t<TOrError>, Error>()) {
return _f(std::forward<TOrError>(_t_or_err));
} else {
return std::forward<TOrError>(_t_or_err);
@@ -311,7 +311,7 @@ class Result {
/// Returns the value or a default.
T value_or(T&& _default) noexcept {
const auto handle_variant = [&]<class TOrError>(TOrError&& _t_or_err) -> T {
using Type = std::decay_t<TOrError>;
using Type = std::remove_cvref_t<TOrError>;
if constexpr (!std::is_same<Type, Error>()) {
return std::forward<T>(_t_or_err);
} else {
@@ -342,4 +342,3 @@ class Result {
} // namespace rfl
#endif