diff options
| author | 2021-11-02 17:23:19 -0400 | |
|---|---|---|
| committer | 2021-11-02 17:23:19 -0400 | |
| commit | cb09ea0f0174162a85f47fdb8446b397c3c57e20 (patch) | |
| tree | 5cbd9a62e1daf1c1de97444858064fe8210df077 /src/core/hle/result.h | |
| parent | hle/result: Amend ResultVal documentation (diff) | |
| download | yuzu-cb09ea0f0174162a85f47fdb8446b397c3c57e20.tar.gz yuzu-cb09ea0f0174162a85f47fdb8446b397c3c57e20.tar.xz yuzu-cb09ea0f0174162a85f47fdb8446b397c3c57e20.zip | |
general: Remove MakeResult helpers
This is made obsolete by the presence of implicit constructors.
Diffstat (limited to 'src/core/hle/result.h')
| -rw-r--r-- | src/core/hle/result.h | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index a1917d32b..3807b9aa8 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h | |||
| @@ -168,7 +168,7 @@ constexpr ResultCode ResultUnknown(UINT32_MAX); | |||
| 168 | * return ResultCode{ErrorModule::Common, 1}; | 168 | * return ResultCode{ErrorModule::Common, 1}; |
| 169 | * } else { | 169 | * } else { |
| 170 | * // Frobnicated! Give caller a cookie | 170 | * // Frobnicated! Give caller a cookie |
| 171 | * return MakeResult(42); | 171 | * return 42; |
| 172 | * } | 172 | * } |
| 173 | * } | 173 | * } |
| 174 | * \endcode | 174 | * \endcode |
| @@ -280,24 +280,6 @@ private: | |||
| 280 | }; | 280 | }; |
| 281 | 281 | ||
| 282 | /** | 282 | /** |
| 283 | * This function is a helper used to construct `ResultVal`s. It receives the arguments to construct | ||
| 284 | * `T` with and creates a `ResultVal` that contains the constructed value. | ||
| 285 | */ | ||
| 286 | template <typename T, typename... Args> | ||
| 287 | [[nodiscard]] ResultVal<T> MakeResult(Args&&... args) { | ||
| 288 | return ResultVal<T>{std::forward<Args>(args)...}; | ||
| 289 | } | ||
| 290 | |||
| 291 | /** | ||
| 292 | * Deducible overload of MakeResult, allowing the template parameter to be ommited if you're just | ||
| 293 | * copy or move constructing. | ||
| 294 | */ | ||
| 295 | template <typename T> | ||
| 296 | [[nodiscard]] ResultVal<std::remove_cvref_t<T>> MakeResult(T&& val) { | ||
| 297 | return ResultVal<std::remove_cvref_t<T>>{std::forward<T>(val)}; | ||
| 298 | } | ||
| 299 | |||
| 300 | /** | ||
| 301 | * Check for the success of `source` (which must evaluate to a ResultVal). If it succeeds, unwraps | 283 | * Check for the success of `source` (which must evaluate to a ResultVal). If it succeeds, unwraps |
| 302 | * the contained value and assigns it to `target`, which can be either an l-value expression or a | 284 | * the contained value and assigns it to `target`, which can be either an l-value expression or a |
| 303 | * variable declaration. If it fails the return code is returned from the current function. Thus it | 285 | * variable declaration. If it fails the return code is returned from the current function. Thus it |