aboutsummaryrefslogtreecommitdiff
path: root/src/optional.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/optional.hpp')
-rw-r--r--src/optional.hpp34
1 files changed, 17 insertions, 17 deletions
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 <typename Handler>
+ template<typename Handler>
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 <typename ObjectType, typename HandlerType>
-auto with(std::optional<ObjectType> &&object, HandlerType handler)
-{
+ template<typename ObjectType, typename HandlerType>
+ auto with(std::optional<ObjectType> && 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