[Boost-bugs] [Boost C++ Libraries] #6710: Boost Containers Using interprocess Basic_strings Need external temporaries

Subject: [Boost-bugs] [Boost C++ Libraries] #6710: Boost Containers Using interprocess Basic_strings Need external temporaries
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-20 00:22:42


#6710: Boost Containers Using interprocess Basic_strings Need external temporaries
-------------------------------------------------------------------+--------
 Reporter: jdy@… | Owner: igaztanaga
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: interprocess, container, map, flat_map, unordered_map |
-------------------------------------------------------------------+--------
 When using an interprocess basic string such as:
 typedef boost::interprocess::allocator<
         char,
         boost::interprocess::managed_mapped_file::segment_manager
> char_allocator_t;

 typedef boost::interprocess::basic_string<
         char,
         std::char_traits<char>,
         char_allocator_t
> key_type;

 map, flat_map (and unordered_map) all require that one have an externally
 created temporary of that type (key_type) created that can temporarily
 hold the results of a std::string or char*. This requires code of the
 form:

       // A temporary string that allocates from the mapped file
       struct shm_clean { // cleanup shared memory on stack-unwind
         shm_clean() {
 boost::interprocess::shared_memory_object::remove("StupidSharedMemory");
         }
         ~shm_clean() {
 boost::interprocess::shared_memory_object::remove("StupidSharedMemory");
         }
       } cleaner;
       boost::interprocess::managed_shared_memory
 stupid(boost::interprocess::create_only ,"StupidSharedMemory" ,500);
       key_type key_val(stupid.get_segment_manager());

 mymap_in_shared_memory[key_val = mystring.c_str()] = junk;

 This is barely ok when we are working with mutable memory regions, but
 when I am working in a read-only memory map, it is annoying.

 Please see this thread:

 http://thread.gmane.org/gmane.comp.lib.boost.devel/228874

 Bug posted at request of Ion Gaztañaga

 Joel

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6710>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC