Boost logo

Boost :

Subject: Re: [boost] [metal] Feature Complete - Request for Feedback
From: Bruno Dutra (brunocodutra_at_[hidden])
Date: 2017-02-21 17:07:23

On Tue, Feb 21, 2017 at 2:38 PM, Deniz Bahadir via Boost <
boost_at_[hidden]> wrote:

> Am 21.02.2017 um 14:03 schrieb Bruno Dutra via Boost:
>> On Tue, Feb 21, 2017 at 10:53 AM, Hans Dembinski <
>> hans.dembinski_at_[hidden]>
>> wrote:
>>> [...]
>> I suppose my big question is this: can't you just merge your
>>> ideas/improvements into boost::mpl? With ifdefs you could enable C++14
>>> features like templated aliases when they are available. Even more so, it
>>> should be possible to merge your speed improvements into boost::mpl.
>> It does sound like a good idea from the user's point of view since Metal
>> looks so similar to MPL, but because they are so drastically distinct
>> internally, merging them into a single library doesn't really make any
>> sense. Fortunately, if you are coming from some legacy metaprogram, it is
>> easy to incrementally migrate to Metal using the helper metal::from_mpl,
>> but there is really no reason to ever use MPL anymore on a new project.
> Could you elaborate a little more on this metal::from_mpl?
> How is it used?
> Can I just replace all occurrences of "boost::mpl" in any code by
> "metal::from_mpl" and it works?

The idea is to be able to connect some preexisting MPL code to Metal, so
that new features may be implemented using Metal already, before eventually
porting everything in a gradual fashion and only if necessary. Thus
metal::from_mpl converts MPL Sequences, Integral Constants and Metafunction
Classes to their equivalents in Metal. It is recursive, so if you have an
mpl::list of mpl::int_, it will produce a metal::list of metal::number.
Check out the examples here:
external.html (click the panel to expand).

> At our company we had to increase the number of elements to 100 and it
> works fine except for the obvious reasons Bruno already talked about. It is
> so damn slow and wastes so much RAM that we can only compile
> single-threaded which slows down compile-performance even more.

> That is why I am so interested in a drop-in replacement for Boost.MPL and
> asked about metal::from_mpl above.

While Metal is not able to replace MPL like this, it can complement it with
the help of metal::from_mpl, which makes it possible to rewrite critical
sections that take the longest to compile for example. Give it a try, gains
with respect to performance and memory consumption are huge!


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