Re: [Boost-users] [Multi-index] Sorted range selection
Hello Tamas,
----- Mensaje original -----
De: Tamas Szepes
Hi All,
I'm learning to use the multi-index library by rewriting an existing STL based code. I'm storing rectangles (X, Y, Width, Height, ...) in a set ordered by a composite key on X, Y.
What is the best way to select rectangles where X has a certain value and sort the result by Width? Can I use a sorted indice on Width, or I must sort the range? I also thought to create a composite key on X and Width, but sorting order is run time determined and I have a dosen other properties.
Your analysis is correct. I'm afraid you have to externally sort
the interval returned by range(), pseudocode follows:
std::vector
I'm realy looking for the possibility to mimic SQL's ORDER BY clause.
Well, Boost.MultiIndex does not aim to provide complete functionality for relational stuff, as stated explicitly in the rationale at http://boost.org/libs/multi_index/doc/tutorial.html. The idea is to keep Boost.MultiIndex application-agnostic and more focused on the STL conceptual framework. As I see it, this kind of funcionality could be better served by a relational-specific lib built on top of Boost.MultiIndex. There are currently two libs approaching this goal, Arkadiy Vertleyb's RTL and Calum Grant's RML (look for those on recent discussions on the Boost list.) Unfortunately, neither of these libs actually uses internally Boost.MultiIndex, but this is another story :)
Thanks for any help in advance,
I'm sorry I can't be more helpful. Thanks for using Boost.MultiIndex and please come back if you have further problems or want to comment on proposals for enhancements of the library. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (1)
-
JOAQUIN LOPEZ MU?Z