Boost logo

Boost :

Subject: Re: [boost] [GSoC][MPL11] Post C++Now update
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2014-05-19 13:34:22


On Mon, May 19, 2014 at 6:11 AM, Zach Laine <whatwasthataddress_at_[hidden]>wrote:

> I was one of the people at the conference that tried to convince Louis to
> approach things this way. I wasn't the only one, and I can only speak for
> myself. The advantage to me is that I might have a library that I can use
> to do *both* compile-time only, and runtime+compiletime operations. Now
> that I have constexpr function and decltype(), I find the lines between
> compiletime and runtime operations to be sufficiently blurred that I don't
> draw the clear distinction I once did. For instance, in C++14, I can
> simply elide certain metafunctions I used to require to compute the return
> values of certain functions -- anything that can be done with a fold can be
> written in the form "auto foo (args) { return fold(some_fn, args); }".
> This makes me gravitate towards a solution that marries runtime and
> compile time as much as possible.
>

I, too, am in support of this and stand by it being an ideal, unless that
ideal proves unfeasible to implement or use. Louis also noticed one huge
advantage of this that cannot be understated -- if a new mpl is implemented
using the automatic return type deduction approach, regardless of whether
or not it is actually merged with fusion, it provides a very powerful way
to debug metaprograms -- simply call the function without decltype but with
the same parameters and you can then step through the code in your favorite
debugger at runtime, including the ability to set breakpoints and step
through line by line. Just make sure that you force your arguments to not
be constexpr so that the evaluation happens at runtime for the sake of
debugging.

-- 
-Matt Calabrese

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