Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: mp11
From: Bruno Dutra (brunocodutra_at_[hidden])
Date: 2017-03-19 18:41:28

On Sun, Mar 19, 2017 at 6:51 PM, Vicente J. Botet Escriba via Boost <
boost_at_[hidden]> wrote:

> Have you considered the possibility to provide algorithms taking HOF as
> well as template aliases?

This is a false dilemma, these are _not_ mutually exclusive, one can have
the exact same lazy API with eager alias templates alone by using bind<>

Following is a snippet using Metal, that implements the cartesian product
of a List by itself. Notice how the upper case are in fact just lazy
adaptors to the eager algorithms metal provides (lower case letters), all
written using eager alias templates.

using namespace metal;
template<typename... args>using Transform = bind<lambda<transform>, args...>;
template<typename... args>using Bind = bind<lambda<bind>, args...>;
template<typename arg>using Quote = bind<lambda<bind>, args>;
template<typename x>using product = apply<
  transform<Transform<Bind<quote<lambda<list>>, Quote<_1>, quote<_1>>,
quote<x>>, x>

Bruno Dutra

Boost list run by bdawes at, gregod at, cpdaniel at, john at