|
Boost : |
From: Vesa Karvonen (vesa.karvonen_at_[hidden])
Date: 2001-07-20 15:01:24
From: "David Abrahams" <david.abrahams_at_[hidden]>
> Hi All
>
> I'm looking for a good facility for the following functionality:
>
> a compile-time Map: type => (type, value)
>
> The idea is that given a Map object and a key type, I should be able to
> extract a corresponding value at compile-time.
>
> I've been looking around at existing facilities, and none of them seem to
> quite fit the bill. For example, the recently accepted boost tuple library
> doesn't seem to be designed for this, although I could be wrong.
>
> Of course I could code it myself, but I'd rather re-use than invent.
I think that with the proposed metaprogramming facilities for tuple library,
such as being able to iterate over the types of the elements of a tuple, this
functionality could be implemented on top of tuple.
[In C++, there is no *compile-time* ordering for types, so the best a generic
compile-time map implementation could do is linear time search. However, if
you want to reduce template recursion depth, you might still want to use a
balanced tree and perform an exhaustive search.]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk