Boost logo

Boost :

Subject: Re: [boost] "Simple C++11 metaprogramming"
From: Peter Dimov (lists_at_[hidden])
Date: 2015-06-02 06:42:36


Bruno Dutra wrote:

> Still, laziness and SFINAE friendliness are the properties I deem most
> fundamental on any metaprogramming library.

I meant to respond to these points too.

The eagerness of template aliases is an obvious problem in at least one
place and that place is mp_if, where the naive mp_if<P<T>, F<T>, G<T>>
evaluates both F<T> and G<T>. But I'm not sure if there are others, under
the assumption that we've no higher-order constructs. Eric Niebler's meta
has an entire lazy:: namespace with deferred copies of all its constructs;
continuing the general theme, I wonder whether all this is strictly needed
once we jettison the lambda part.

SFINAE friendliness can be quite a curse. It often transforms reasonably
comprehensible error messages into full-scale Agatha Christie mysteries (the
compiler output even being of comparable length). So I'm not convinced (at
the moment) that a metaprogramming library should be SFINAE-friendly. I
presently tend to lean towards the philosophy of static_assert'ing as much
as possible, and leaving the primary templates undefined instead of empty.


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