Open
Description
As shown by the example below, lazy proxies help reducing clutter when fancy composition is desired, the question is where to put them. One option would be within namespace metal::lazy
, another would be to name them like shown below, so they could live at the root of namespace metal
.
originally posted on cpplang.slack.com
using namespace metal; template<typename... args> using Transform = bind<lambda<transform>, args...>; template<typename... args> using If_ = bind<lambda<if_>, args...>; template<typename... args> using Invoke = bind<lambda<invoke>, args...>; using lbd = Transform<If_<Invoke<_1, _2, _3>, _2, _3>, quote<l>>;
Given a predicate
pred
and unary lambdasf
andg
, you can then conditionally transforml
with eitherf
org
according topred
.invoke<lbd, pred, f, g>;