Re: map/multimap/wildcards
- From: "Jason S" <jmsachs@xxxxxxxxx>
- Date: 8 Jun 2006 14:07:01 -0700
Igor Tandetnik wrote:
You can't. But for your problem, you don't need to. lower_bound(x) will
give you the lexicographically smallest string greater than or equal to
x. Under your comparison predicate, that would be the smallest string
whose prefix is x (if such exists). Once you found the place, you can
double-check with strcmpn.
Right, I get how it would work assuming the map is populated correctly.
But how would it manage to order the elements correctly to start with?
Maybe I'm missing something... or does this require the following
"clever" assumptions which might be true:
a) map<>s and multimap<>s determine equality by calling compare<a,b>
and compare<b,a> & seeing if they're both false
b) if f(a,b) = strncmp(a,b,length(b))<0 then f(a,b) and f(b,a) are
both false (I think) only if a and b are identical strings
.
- Follow-Ups:
- Re: map/multimap/wildcards
- From: Stephen Howe
- Re: map/multimap/wildcards
- From: Jason S
- Re: map/multimap/wildcards
- References:
- map/multimap/wildcards
- From: Jason S
- Re: map/multimap/wildcards
- From: Igor Tandetnik
- Re: map/multimap/wildcards
- From: Jason S
- Re: map/multimap/wildcards
- From: Igor Tandetnik
- map/multimap/wildcards
- Prev by Date: Re: map/multimap/wildcards
- Next by Date: Re: map/multimap/wildcards
- Previous by thread: Re: map/multimap/wildcards
- Next by thread: Re: map/multimap/wildcards
- Index(es):
Relevant Pages
|