From: Matthias Schabel (boost_at_[hidden])
Date: 2004-01-08 11:26:42
> The right (i.e. compile-time-fast) way do do this is not with
> mpl::list but
> with mpl::map. To my knowledge, such a beast does not currently exist,
> but it
> can be done. See e.g. here:
It would be obviously interesting to see such a beast incorporated into
MPL, though, as you
point out, it isn't entirely clear how much the O(n) vs O(n^2) issue
contributes to compile time
as compared to the prefactor from the use of the MPL machinery.
> By the way, I was doing exactly the kind of library you've done, and
> exactly the same brick wall you did: very slow compilation. I attempted
> to redo everything with maps instead of lists, but had not enough time
> to finish it (day time job and all). Hope you have better luck.
Thanks. At this point, like everyone else, I've got my day job to
consider and, being winter in
Salt Lake City, the skiing is a constant distraction ;^) That and,
honestly, learning to use MPL
was enough of a challenge for me to make the prospect of developing new
I'm sort of hoping that the MPL folks will volunteer to help out in
optimizing the algorithms... It
seems like it could be an interesting case study in a non-toy
application of metaprogramming.
> My other idea was this:
> typedef tag < 'm', 'e', 't', 'r', 'e' > metre_tag;
> typedef tag < 's', 'e', 'c', 'o', 'n', 'd'> second_tag;
> One can sort on such tags at compile time. But the syntax is too ugly.
> C++ rules on what can constitute constant expression and template
> should be seriously relaxed IMO.
Given the resistance that simple template syntax is encountering from
some quarters, I can't
imagine that this sort of tortured syntax would be popular ;^) Just
adding string template arguments
would go a long way toward facilitating metaprogramming...
Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
mschabel at ucair med utah edu
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk