From e2f4ab77b6dd4dd9b82d701158162056c874ed7e Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 24 Feb 2023 22:53:42 +0000 Subject: [PATCH] Add helper utility for checking values are `true` in coral --- source/coral.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/coral.cpp b/source/coral.cpp index 3edd14f..8843e77 100644 --- a/source/coral.cpp +++ b/source/coral.cpp @@ -333,6 +333,14 @@ export namespace coral { returns(* dispatch)(void *, arguments...); }; + /** + * Helpful wrapper utility for using in chainable conditionals like [coral::expected::and_test] to check if a `bool` + * is `true` without writing a lambda. + */ + constexpr bool is_true(bool value) { + return value; + } + /** * Monadic container for a single-`element` value or nothing. */