bb wrote:
Hi,
void fun(const std::map<std::string,int>& m1) {
// How to make a case insensitive search of this map without
making a copy?
}
cheers.
Essentially what you're asking for is a std::map with two different
keys, (one case sensitive, one case insensitive) which is impossible.
You need to rework your problem. You could try
std::map<case_insensitive_string, int>
or
std::map<std::string, int, case_insensitive_comparator>
or
you could convert all strings to one case before inserting into the map.
If you really need both case sensitive and case insensitive searches on
the same map, you are going to have to come up with a more complex data
structure yourself. You can't expect the standard library to do
everything for you.
john