From b166f3512f5e426e60a4ff610a9f07239ac18ea1 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Thu, 13 Jul 2017 10:23:55 +0200 Subject: clang-format, mostly indenting. Signed-off-by: Marcus Fritzsch --- src/result.hpp | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'src/result.hpp') 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 - struct result { - char const *e; - optional t; +// We only ever return a string as an error - so just parametrize +// this over result type T +template +struct result { + char const *e; + optional 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 - struct result Err(char const *e) { return result{e, nullopt}; } +template +struct result Err(char const *e) { + return result{e, nullopt}; +} - template - struct result Ok(T t) { return result{nullptr, t}; } +template +struct result Ok(T t) { + return result{nullptr, t}; +} -} // namespace wm +} // namespace wm -#endif //TMCAGLWM_RESULT_HPP +#endif // TMCAGLWM_RESULT_HPP -- cgit 1.2.3-korg