aboutsummaryrefslogtreecommitdiff
path: root/lib/fwdlib.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fwdlib.hpp')
-rw-r--r--lib/fwdlib.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/fwdlib.hpp b/lib/fwdlib.hpp
index bb5084c..623dc13 100644
--- a/lib/fwdlib.hpp
+++ b/lib/fwdlib.hpp
@@ -40,6 +40,14 @@ static void fwd_copy(auto n, auto next)
return next(n, n);
}
+static void fwd_null(auto *x, auto fail, auto ok)
+{
+ if (x)
+ return ok(*x);
+ else
+ return fail();
+}
+
static void fwd_insert(auto container, auto elem, auto next)
{
container.insert(std::move(elem));
@@ -51,4 +59,10 @@ static void fwd_println(auto elem)
cout << elem << endl;
}
+static void fwd_intalloc(auto ok)
+{
+ int *p = new int{20};
+ ok(p);
+}
+
#endif /* FWDLIB_HPP */