Boost logo

Boost :

From: Anatoli Tubman (anatoli_at_[hidden])
Date: 2004-01-08 05:36:28


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:

http://216.239.41.104/search?q=cache:1WM4rEuWG1kJ:lists.boost.org/MailArchives/boost/msg26646.php+%3C200310011506.43968.anatoli%40ptc.com%3E&hl=en&ie=UTF-8

Sorry for a long Google cache link; I can't seem to find the real thing now.

With this, comparison and merge are probably O(n) instead of O(n^2) that we
have with mpl::list. I don't know whether it will significantly improve
compilation time.

By the way, I was doing exactly the kind of library you've done, and hit
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.

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 argument
should be seriously relaxed IMO.

-- 
anatoli at ptc dot com -- opinions are mine

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