|
Boost : |
Subject: Re: [boost] interprocess with unordered_map
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-03-15 19:02:00
2012/3/15 Ion Gaztañaga <igaztanaga_at_[hidden]>:
> El 15/03/2012 23:18, Olaf van der Spek escribió:
>>
>> 2012/3/15 Ion Gaztañaga<igaztanaga_at_[hidden]>:
>>>
>>> El 15/03/2012 3:14, Joel Young escribió:
>>>>
>>>>
>>>> Can the interprocess::basic_string be modified to allow these
>>>> conversions?
>>>>
>>>> I hate having to do:
>>>>
>>>> key_val = "fruitcake";
>>>> db.find(key_val);
>>>
>>>
>>>
>>> interprocess::basic_string is now boost::container::basic_string, which
>>> follows std::basic_string interface. And you always need an allocator to
>>> place the string in shared memory. I don' think it could be implicitly
>>> constructible from char* or std::string.
>>
>>
>> But there's no (good) reason for the input to be required to be in
>> shared memory.
>
>
> A shared memory allocator is designed to allocate from a managed shared
> memory segment. And this requires a base address of that shared memory
> segment . And even with std::string you need to build a temporary string to
> compare it with the ones stored in the container.
>
> Do you have any proposal or alternative idea?
Yes, do a direct compare between your key type and const char*
-- Olaf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk