multi-index/interprocess find key must be allocated in shared memory?
Hi, I have a multi_index set working nicely in shared memory but I'm trying to figure out how to search one of my indices without allocating the search key in shared memory. Assuming my index is based on a char_string (basic_string with a segment manager allocator), is there an easy way to perform a find() operation that can use a const char *key? Trying to avoid the rather substantial overhead of instantiating my const char *key as a char_string in shared memory. Any other suggestions how I might organize things to avoid the situation would be welcomed.. Cheers, Jerry Hicks
Jerry Hicks escribió:
Hi, I have a multi_index set working nicely in shared memory but I'm trying to figure out how to search one of my indices without allocating the search key in shared memory.
Assuming my index is based on a char_string (basic_string with a segment manager allocator), is there an easy way to perform a find() operation that can use a const char *key?
Special lookup operations (http://tinyurl.com/yarvxfe ) come to the
rescue. Write
x.find("whatever",special_char_string_compare());
with
struct special_char_string_compare
{
bool operator()(const char_string& x,const char* y)const
{
return x
joaquin@tid.es wrote:
Special lookup operations (http://tinyurl.com/yarvxfe ) come to the rescue. Write
x.find("whatever",special_char_string_compare());
There it was, right in front of me! Thanks so much for the doc pointer/ Dunno how I missed it, this is perfect :-) Cheers, Jerry.
participants (2)
-
Jerry Hicks
-
joaquin@tid.es