From 14a2e00b39140935cb0171b4b56e98dbc6ed27d1 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Tue, 17 May 2022 18:21:41 +0300 Subject: [PATCH] Add helper callable objects that always return the same result --- libs/util/include/psemek/util/functional.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/util/include/psemek/util/functional.hpp b/libs/util/include/psemek/util/functional.hpp index dd6fcfd7..daa8bc71 100644 --- a/libs/util/include/psemek/util/functional.hpp +++ b/libs/util/include/psemek/util/functional.hpp @@ -7,6 +7,12 @@ namespace psemek::util constexpr auto id = [](auto && x) -> decltype(auto) { return x; }; + template + constexpr auto always = [](auto && ...){ return value; }; + + constexpr auto always_true = always; + constexpr auto always_false = always; + template auto constant(T const & x) {