aboutsummaryrefslogtreecommitdiff
path: root/include/Result.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-02-14 10:43:26 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-18 15:22:09 +0100
commit83c78e2b5cc9b0cb737ec3785722ae280bd29b65 (patch)
tree8c1f522bc19d4adc7df849fe09f8afc9513f9d65 /include/Result.hpp
parent23a37b2cdd8ffde8bb85a4159888bf3a7ec35966 (diff)
Use shader from file..
Diffstat (limited to 'include/Result.hpp')
-rw-r--r--include/Result.hpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/Result.hpp b/include/Result.hpp
index 50a0d0c..86ae176 100644
--- a/include/Result.hpp
+++ b/include/Result.hpp
@@ -11,9 +11,7 @@ namespace amalgine
public:
static Result<T> Ok(T data)
{
- Result<T> result;
- result.data = std::move(data);
- result.errorCode = 0;
+ Result<T> result(std::move(data));
return result;
}
@@ -42,11 +40,17 @@ namespace amalgine
assert(isOk());
return data;
}
+
+ T* operator -> () {
+ assert(isOk());
+ return &data;
+ }
const std::string& getErrorMsg() const { return errorMsg; }
int getErrorCode() const { return errorCode; }
private:
- Result(){}
+ Result() {}
+ Result(T data) : data(std::move(data)), errorCode(0) {}
private:
T data;
int errorCode;