Boost logo

Boost Users :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-06-06 07:00:09


Prashant Thakre ha escrito:

> Hi,
> I would like to know if it's possible to define a multi_index using
> composite_key,where the number of keys which are part of the
> composite_key are only known at run-time.
> Thanks again.
> --
> regards,
> Prashant Thakre

Hello,

The short answer is no, you must know the number of keys a
composite_key is made of at compile time. The long answer is,
depending on your usage scenario, maybe you can have something
close to what you're after:

1. If the maxium number of keys of the composite_key is bounded
then you can use that maximum and later on, at run-time, take
advantage of only the first N key slots.
2. You can have std::vector<> as the key, the comparison semantics
of this container in some ways resembles that of an infinite-length
composite key.

If you can describe what you are pursuing with a little more detail
maybe I can provide more focused help.

Thanks for using B.MI, best regards,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net