From 60ccc62f4934e44ad5b905fdbcf458302b8d8a09 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Fri, 3 Jun 2022 23:26:44 -0700 Subject: Changeset: 63 [WIP] Rename directories --- source/Common/YCombinator.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 source/Common/YCombinator.hpp (limited to 'source/Common/YCombinator.hpp') diff --git a/source/Common/YCombinator.hpp b/source/Common/YCombinator.hpp new file mode 100644 index 0000000..b1d2350 --- /dev/null +++ b/source/Common/YCombinator.hpp @@ -0,0 +1,14 @@ +#pragma once + +template +struct YCombinator { + // NOTE: implicit constructor allows initializing this + Func func; + + template + decltype(auto) operator()(Ts&&... args) const { + // NOTE: static_cast(args)... is equivalent to std::forward(args)... + // written this way so that we don't have to include , as well as reducing template instanciations to help compile time + return func(*this, static_cast(args)...); + } +}; -- cgit v1.2.3-70-g09d2