map/multimap/wildcards



Argh. I keep an index (presently implemented as map<char *, long,
pchar_cmp> where pchar_cmp calls strcmp() appropriately; the "char *"s
are stored elsewhere & will exist as long as the map does) for
character string lookup in sorted order. Works great for exact matches.
Now I need an alternate accessor (need to keep the exact-match lookup
around) to use it for string completion, e.g. find all the entries that
start with an arbitrary string. I am *NOT* going to expand this to
regexp searches (which I have no idea how to implement efficiently).

This seems to cry out for a multimap, I think... but I somehow need to
parametrize the find() method to specify exact matches or partial
matches.

The "dumb" method is to walk through the entire map, checking each item
one by one. There could be hundreds or thousands of strings in my case
& I don't want to do that.

any suggestions?

.



Relevant Pages

  • Re: map/multimap/wildcards
    ... character string lookup in sorted order. ... This seems to cry out for a multimap, ... multimap won't help you there: the only difference between a map and a ...
    (microsoft.public.vc.stl)
  • Re: Oracle Connection Pooling
    ... > public String oracleFormatUrl(String prefix, String host, String port, ... > proprietaryException { ... > * Map from a resource attribute to a proprietary attribute. ... > protected void processCreateRequests ...
    (comp.lang.java.databases)
  • Re: Irregular review procedures for IACR sponsored conferences
    ... There are only three theorems. ... The second says that if you apply the map to an arbitrary but sufficiently ... long string, substrings of the image are uniformly distributed. ... the policy might look pretty dubious. ...
    (sci.crypt)
  • Re: Regarding use of ArrayList as value in Hashtable
    ... say, for example,the value is a String array, with String array then we ... Lists, Integers, and Strings. ... An object splits the stream of characters into tokens of type: MAP, ... enum BContainers{ ...
    (comp.lang.java.programmer)
  • java.lang.NullPointerException..help me!
    ... public UploadedFile getMyFile() { ... // Populate the map from the input file. ... String line = null; ... // Create the array for the numbers which make up the rest of the line. ...
    (comp.lang.java.programmer)

Loading