Re: [Boost-users] [multi_index].[composite_key] Index creation at run-time.
Hi, Thanks for the reply. This is what I am trying to achieve: a) Each entry in the container will have tuple containing n-elements tuple < t0, t1 ..., tn >, where n is known at run-time. This entry will also have other elements. b) Multi_index container will have a composite_key, consisting of each tuple element. As per 2) it should be possible to just have std::vector<T> as a tuple and define the composite key in terms of each element of the tuple i.e. [ tuple.at(0), ..., tuple.at(n-1) ]. Please correct me if am wrong. Thanks once again. -- regards, Prashant Thakre
Date: Tue, 06 Jun 2006 13:00:09 +0200 From: Joaqu?n M? L?pez Mu?oz
Subject: Re: [Boost-users] [multi_index].[composite_key] Index creation at run-time. To: boost-users@lists.boost.org Message-ID: <44856039.19A00631@tid.es> Content-Type: text/plain; charset=iso-8859-1 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
participants (1)
-
Prashant Thakre