map/multimap/wildcards
- From: "Jason S" <jmsachs@xxxxxxxxx>
- Date: 8 Jun 2006 11:23:13 -0700
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?
.
- Follow-Ups:
- Re: map/multimap/wildcards
- From: Arnaud Debaene
- Re: map/multimap/wildcards
- From: Igor Tandetnik
- Re: map/multimap/wildcards
- From: Stephen Howe
- Re: map/multimap/wildcards
- Prev by Date: Re: ifstream and unicode
- Next by Date: Re: map/multimap/wildcards
- Previous by thread: ifstream and unicode
- Next by thread: Re: map/multimap/wildcards
- Index(es):
Relevant Pages
|
Loading