Changes between Initial Version and Version 1 of Ticket #10777


Ignore:
Timestamp:
Nov 9, 2014, 11:49:31 PM (8 years ago)
Author:
Daniel James
Comment:

I've removed the assertion in develop.

https://github.com/boostorg/unordered/commit/31211a607f1c294f973eed10e54e461a8ef920ba

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10777

    • Property Status newassigned
  • Ticket #10777 – Description

    initial v1  
    33here is my problem: I have a stateful allocator that has a bunch of stuff inside of it. It can be move-assigned. The problem is that boost::unordered_map does this when you have propagate_on_container_move_assign typedeffed to true_type:
    44
     5{{{
    56my_alloc a;
    67my_alloc b;
    78a = std::move(b);
    89ASSERT(a == b);
     10}}}
    911
    1012That assert can obviously never be true if my_alloc is stateful, but this sequence of events currently happens in boost::unordered_map.
     
    1214Here is an allocator that shows the problem:
    1315
     16{{{
    1417#pragma once
    1518 
     
    119122    std::vector<T *> available;
    120123};
    121 
     124}}}
    122125
    123126And here is a sequence of events with which you can get it:
    124127
     128{{{
    125129boost::unordered_map<int, int, std::hash<int>, std::equal_to<int>, plalloc<int>> a = { { 1, 2 } };
    126130boost::unordered_map<int, int, std::hash<int>, std::equal_to<int>, plalloc<int>> b = { { 3, 4 } };
     
    128132a = std::move(b);
    129133a = c;
     134}}}