Boost logo

Boost :

Subject: Re: [boost] "Simple C++11 metaprogramming"
From: Peter Dimov (lists_at_[hidden])
Date: 2015-06-01 19:55:24


Bruno Dutra wrote:
> The need for so called metafunction-classes arises most naturally as soon
> as one decides to write a metafunction that returns another metafunction.
> As pointed out by Vincente Escriba, template aliases can't allow for an
> indistinguishable handling of metafunctions and variables (that is types),
> for the obvious reason they can't match template type parameters.

I actually know all that. That's kind of the point.

You can't just say "we need higher-order metaprogramming to return
metafunctions from metafunctions" - this is a tautology. This is what
"higher-order metaprogramming" means. You're basically saying that we need
higher-order metaprogramming to do higher-order metaprogramming. True but
trivial.

There obviously do exist occasions that call for higher-order
metaprogramming. The question is can we get by in 97% of the cases without
it. Not whether it's useful, but whether it's indispensable. Whether there's
a room for a "simple" metaprogramming library that doesn't provide
higher-order constructs and is therefore based on template aliases and not
on metafunction classes, and whether such a library can be adequately useful
for real world tasks. (I'm open to the possibility that the answer is "no",
but I'd like it to be "yes".)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk