
Oncaphillis wrote:
my_map::iterator i = the_map->find(my_string("BOGUS",my_char_allocator_t(shm)));
Is there a way to use heap or stack memory for thinks like that ?
This is an example of a larger problem that has worried me occasionally. For example, say I have a vector of structs sorted according to a string member; I might like to write: std::vector<my_struct> v; std::lower_bound(v.begin(), v.end(), std::string("hello"), COMP()); COMP needs to be a functor that can compare one of my structs with a std::string. That's not a problem, and in fact code like this will actually work with some standard libraries. But the standard requires that COMP takes two arguments of the same type, so standard library that did more checking would reject it. With algorithms like std::lower_bound it is of course possible to write one's own version that allows this sort of use. But there is more of a problem with member functions like map::find. Is anyone aware of any rationale for the current requirements? Phil.