Opened 8 years ago

Closed 6 years ago

#11143 closed Bugs (fixed)

Problem with container::set::operator=()

Reported by: Andrey Martin <martin@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

There appeared to be a problem with set::operator=(). In the example below, the second assignment performs "move" every element from s1 to s2. The size of s1 is not changed.

Tested on VS2012 with boost 1.57

#include <boost/container/set.hpp>

int main()
{
    boost::container::set<std::string> s1, s2;

    s1.insert("1");
    s1.insert("2");
    
    s2 = s1;
    assert(s2.size() == s1.size());
    assert(s2 == s1); // OK

    s2 = s1; 
    assert(s2.size() == s1.size());
    assert(s2 == s1); // Error

    return 0;
}

Change History (4)

comment:1 by Ion Gaztañaga, 8 years ago

Your code seems to work fine with current develop and master (you can try Boost 1.58 beta) code. Can we consider this fixed?

in reply to:  1 comment:2 by Andrey Martin <martin@…>, 8 years ago

Yes we can. I'd add a unit test to avoid this issue in the future.

comment:3 by viboes, 7 years ago

Ion?

comment:4 by Ion Gaztañaga, 6 years ago

Resolution: fixed
Status: newclosed

Declared as fixed ;-)

Note: See TracTickets for help on using tickets.