diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-07-13 10:23:55 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-08 17:24:00 +0200 |
commit | b166f3512f5e426e60a4ff610a9f07239ac18ea1 (patch) | |
tree | 9b774db75f88f9652c185ee6f5942cfa72370933 /src/result.hpp | |
parent | e04b072b79044ca1220499f6d39532c6c98f81db (diff) |
clang-format, mostly indenting.
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/result.hpp')
-rw-r--r-- | src/result.hpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/result.hpp b/src/result.hpp index fe9956b..377d5a2 100644 --- a/src/result.hpp +++ b/src/result.hpp @@ -9,30 +9,34 @@ namespace wm { - using std::experimental::optional; - using std::experimental::nullopt; +using std::experimental::optional; +using std::experimental::nullopt; - // We only ever return a string as an error - so just parametrize - // this over result type T - template<typename T> - struct result { - char const *e; - optional<T> t; +// We only ever return a string as an error - so just parametrize +// this over result type T +template <typename T> +struct result { + char const *e; + optional<T> t; - bool is_ok() const { return this->t != nullopt; } - bool is_err() const { return this->e != nullptr; } + bool is_ok() const { return this->t != nullopt; } + bool is_err() const { return this->e != nullptr; } - T unwrap() { return this->t.value(); } + T unwrap() { return this->t.value(); } - char const *unwrap_err() { return this->e; } - }; + char const *unwrap_err() { return this->e; } +}; - template<typename T> - struct result<T> Err(char const *e) { return result<T>{e, nullopt}; } +template <typename T> +struct result<T> Err(char const *e) { + return result<T>{e, nullopt}; +} - template<typename T> - struct result<T> Ok(T t) { return result<T>{nullptr, t}; } +template <typename T> +struct result<T> Ok(T t) { + return result<T>{nullptr, t}; +} -} // namespace wm +} // namespace wm -#endif //TMCAGLWM_RESULT_HPP +#endif // TMCAGLWM_RESULT_HPP |