aboutsummaryrefslogtreecommitdiff
path: root/lib/fwdlib.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fwdlib.hpp')
-rw-r--r--lib/fwdlib.hpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/fwdlib.hpp b/lib/fwdlib.hpp
index 3efac61..5c52f65 100644
--- a/lib/fwdlib.hpp
+++ b/lib/fwdlib.hpp
@@ -10,23 +10,15 @@
using namespace std;
-static void fwd_if(auto cond, auto ok, auto fail)
-{
- if (cond)
- ok();
- else
- fail();
-}
-
static void fwd_getline(auto next)
{
if (cin.eof())
- next(optional<string>{});
+ return next(optional<string>{});
if (string line; getline(cin, line))
- next(optional<string>{line});
+ return next(optional<string>{line});
else
- next(optional<string>{});
+ return next(optional<string>{});
}
static void fwd_foreach(auto container, auto next)
@@ -38,15 +30,15 @@ static void fwd_foreach(auto container, auto next)
static void fwd_some(auto option, auto ok, auto fail)
{
if (option)
- ok(std::move(option.value()));
+ return ok(std::move(option.value()));
else
- fail();
+ return fail();
}
static void fwd_insert(auto container, auto elem, auto next)
{
container.insert(std::move(elem));
- next(std::move(container));
+ return next(std::move(container));
}
static void fwd_println(auto elem)