Add helper callable objects that always return the same result

This commit is contained in:
Nikita Lisitsa 2022-05-17 18:21:41 +03:00
parent bb971ff412
commit 14a2e00b39

View file

@ -7,6 +7,12 @@ namespace psemek::util
constexpr auto id = [](auto && x) -> decltype(auto) { return x; };
template <typename T, T value>
constexpr auto always = [](auto && ...){ return value; };
constexpr auto always_true = always<bool, true>;
constexpr auto always_false = always<bool, false>;
template <typename T>
auto constant(T const & x)
{