Add helper callable objects that always return the same result
This commit is contained in:
parent
bb971ff412
commit
14a2e00b39
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue