|
Boost : |
Subject: Re: [boost] boost::interprocess mixing heap and shared memory ?
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2009-04-11 14:01:07
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk