mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-10 12:04:36 -04:00
fix Ok() and Err() causing unexpected implicit moves
This commit is contained in:
parent
a91905bd4c
commit
98d5216dcd
1 changed files with 4 additions and 2 deletions
|
@ -257,12 +257,14 @@ namespace geode {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
constexpr impl::Success<T> Ok(T&& value) {
|
||||
constexpr impl::Success<T> Ok(T value) {
|
||||
// DO NOT MAKE THE PARAMETER T&&!!!! THAT WILL CAUSE C++ TO DO UNEXPECTED
|
||||
// IMPLICIT MOVES FOR EXAMPLE WHEN DOING `Ok(unordered_map.at(value))`
|
||||
return impl::Success<T>(std::forward<T>(value));
|
||||
}
|
||||
|
||||
template <class E>
|
||||
constexpr impl::Failure<E> Err(E&& error) {
|
||||
constexpr impl::Failure<E> Err(E error) {
|
||||
return impl::Failure<E>(std::forward<E>(error));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue