Opened 11 years ago
Closed 10 years ago
#6606 closed Bugs (fixed)
Map: rbtree_node doesn't use allocator_traits to construct m_data
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | container |
Version: | Boost 1.49.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I'm not at all sure what the best way to fix this is. The STL implementation that ships with the Visual Studio 11 preview calls allocate for the tree node and then construct for each of the members (the actual tree node constructor never gets called, as far as I can tell).
Change History (3)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
One further note:
I was reading through the standard, and came across this (§23.2.1¶3):
For the components affected by this subclause that declare an allocator_type
, objects stored in these components shall be constructed using the allocator_traits<allocator_type>::construct
function and destroyed using the allocator_traits<allocator_type>::destroy
function (20.6.8.2). These functions are called only for the container’s element type, not for internal types used by the container. [ Note: This means, for example, that a node-based container might need to construct nodes containing aligned buffers and call construct to place the element into the buffer. —end note ]
My understanding, then, is that while construct
should be called for the pair, it should not be called for rbtree_node
(which it currently is).
I guess another option would be to tuck a class like this (which I just made up) into your details, somewhere:
And then have members of this class.