Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-11-29 07:50:48

Alexander Nasonov wrote:
> I have implemented typeof+mpl::set based "unique" algorithm for overloads
> library. MPL associative containers are impressive, I must say.
> On an overload set containing 200 functions with unique signatures at
> positions 1, 2, 10, 39 and 200 new version compiles in 12 seconds on
> my notebook while for old version it's 47 seconds.
> What is a secret of mpl::set? I expected it's typeof-based like "at" for
> vectors, but it seems it's not. If it doesn't use typeof, may be I could
> try to put mpl::set idea into my algorithm?

The tiny prototype that started all this is at:

In short, you don't need typeof for set. You can just use overloading
to find out if the element is in there. For map, if you don't have
typeof, you map each key type into a unique integer constant, and use
that to do constant-time lookup via specialization, just like an
mpl::vector would.

Yeah, that part's pretty clever if I do say so myself. ;-)


Dave Abrahams
Boost Consulting

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