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:
http://lists.boost.org/MailArchives/boost/msg53032.php

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. ;-)

HTH,

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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