You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 lambdas f and g, you can then conditionally transform l with either f or g according to pred.
invoke<lbd, pred, f, g>;
The text was updated successfully, but these errors were encountered:
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 namespacemetal
.The text was updated successfully, but these errors were encountered: