From 0c1d1a0f24655c22a373c19aac90a6a225a353e6 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 8 Dec 2018 10:43:50 +0100 Subject: wanda: reformat source code --- src/optional.hpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/optional.hpp') diff --git a/src/optional.hpp b/src/optional.hpp index 5e1c630..3c964db 100644 --- a/src/optional.hpp +++ b/src/optional.hpp @@ -11,37 +11,37 @@ namespace wanda::std_ext { - -struct failable -{ + struct failable + { constexpr static auto success() { return failable{false}; } constexpr static auto failure() { return failable{true}; } - template + template constexpr auto operator||(Handler handler) const { - if (m_failed) - { - handler(); - } + if (m_failed) + { + handler(); + } } private: - constexpr explicit failable(bool failed) : m_failed{failed} {}; + constexpr explicit failable(bool failed) + : m_failed{failed} {}; bool const m_failed; -}; + }; -template -auto with(std::optional &&object, HandlerType handler) -{ + template + auto with(std::optional && object, HandlerType handler) + { if (object) { - handler(object.value()); - return failable::success(); + handler(object.value()); + return failable::success(); } return failable::failure(); -} + } -} // namespace wanda::std_ext +} // namespace wanda::std_ext #endif \ No newline at end of file -- cgit v1.2.3