Boost logo

Boost Users :

Subject: [Boost-users] [Interprocess][Container] nested containers and scoped allocators
From: Malko (malko.bravi_at_[hidden])
Date: 2015-08-13 17:17:26


First of all my setup: I am compiling on redhat 6 with clang 3.4 in C++03,
using boost_1_58.

In a project of mine I am using a map<int, vector&lt;int>> (types to be
stored in shared memory and I am using the proper allocators as per
interprocess documentation). If mymap is an instance of such a type, then


is an invalid syntax because of issues that, to the best of my
understanding, are related to the fact that the map tries to use the default
constructor (with the default allocator) for the nested type as operator[]
also accounts for the case in which the entry is missing and must be
Using at() instead of operator[] makes the whole thing compile.

On construction, I give the usual instance of allocator<void,
segment_manager> to mymap.
According to what I read in Boost.Container docs:
It would seem to me that a scoped allocator is a mechanism by which the
allocator I gave to mymap is passed down to the nested vector. In which case
I would expect operator[] to try to use such allocator instead of the
default one.

But then again, I always do
mymap.insert(std::pair<const int, vector<int,...>>(0,
to add an element to the map, since I need to specify the allocator (and the
examples in interprocess use this syntax).

Given all of this, I would be grateful for any insight into the following:
1. If the scoped allocator is meant to be passed from the map to the vector,
why can I not use operator[] and I necessarily need to use insert() to
create a new vector in the map? Have I misunderstood what a scoped allocator

Thanks in advance.

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at