Am 21.02.2017 um 18:07 schrieb Bruno Dutra via Boost:
On Tue, Feb 21, 2017 at 2:38 PM, Deniz Bahadir via Boost < boost@lists.boost.org> 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@gmail.com> 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: http://brunocodutra.github.io/metal/group__ external.html (click the panel to expand).
Ahh, clicking the panel makes sense. :-) I did not try this before and thought that doc-generation just failed there (or that none was available). Maybe, you should change the default view to be expanded (if possible).
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!
Our problem is, that we never really used Boost.MPL directly. We just got it for "free" as a (costly) dependency through other Boost libraries (e.g. Boost.MSM). So, I am not really looking forward to changing anything there. Using "find/replace", however, to just change the namespaces would have been a great (= easy) solution. But if find time I will see if Metal can help here.
Regards, Bruno
Thanks, Deniz