Re: [Boost-bugs] [Boost C++ Libraries] #6533: Can't use map with incomplete type and interprocess allocator

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6533: Can't use map with incomplete type and interprocess allocator
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-24 16:38:39


#6533: Can't use map with incomplete type and interprocess allocator
-------------------------------------------------+--------------------------
  Reporter: Erik Jensen <Erik.Jensen@…> | Owner: igaztanaga
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: container
   Version: Boost 1.48.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------------------------+--------------------------

Comment (by igaztanaga):

 First of all, the code is wrong as the first parameter of std::pair should
 be const:

 boost::interprocess::allocator<std::pair<CONST std::string, Incomplete>,

 Does this compile? My local version (for boost 1.50) compiles, so it will
 be fixed.

 #include <string>
 #include <boost/interprocess/allocators/allocator.hpp>
 #include <boost/interprocess/containers/map.hpp>
 #include <boost/interprocess/managed_shared_memory.hpp>

 class Incomplete;
 typedef boost::interprocess::allocator<std::pair<const std::string,
 Incomplete>,
     boost::interprocess::managed_shared_memory::segment_manager>
 Allocator;
 typedef boost::interprocess::map<std::string, Incomplete,
     std::less<std::string>, Allocator> IncompleteMap;
 class Incomplete
 {

    Allocator foo; // No error here
    IncompleteMap bar; // Error!
    public:
    Incomplete()
       : foo(0), bar(IncompleteMap::key_compare(), foo)
    {}
 };

 int main()
 {
    Incomplete incomplete;
    return 0;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6533#comment:1>
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