
Hello Matias, Sunday, June 10, 2007, 1:04:47 AM, you wrote:
I failed to make use of B.MI ordered or hashed indices because of the constraints they apply to the CompatibleKey, CompatibleCompare, CompatibleHash and CompatiblePred objects I would have to provide.
If given two strings s1 and s2 with or without wildcards you can define an order between them, something like:
? * ?? ?* .. .. a a? a* .. ..
You can use ordered_index if your application can work with O(log(n)) lookup.
I don't see how could I do that since for ordering the elements in the container I need strict weak ordering, and for element lookup by a full string I need a more relaxed ordering. For example: ax a? a* Now, if I search by "ab" string, there are two wildcards that fit the string (and in terms of ordered_index, there are two elements whose keys are equivalent to the string). And this is not allowed by the requirements in the docs. BTW, the second element should have been found since "a?" describes "ab" more precisely than "a*".
With respect to the structure layout you are using, a bimap can be used:
bimap< set_of<string, WildcardOrder>, unordered_set_of<int> >
No, bimap doesn't seem to suit me since the container holds not only the wildcard and int. -- Best regards, Andrey mailto:andysem@mail.ru