Code Review
/
staging
/
windowmanager.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
json_helper: use json-c object creation
[staging/windowmanager.git]
/
src
/
result.hpp
diff --git
a/src/result.hpp
b/src/result.hpp
index
fe9956b
..
377d5a2
100644
(file)
--- a/
src/result.hpp
+++ b/
src/result.hpp
@@
-9,30
+9,34
@@
namespace wm {
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