incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-635) std::deque::swap invalidates begin() and end() iterators on empty container
Date Thu, 01 Nov 2007 20:03:50 GMT
std::deque::swap invalidates begin() and end() iterators on empty container
---------------------------------------------------------------------------

                 Key: STDCXX-635
                 URL: https://issues.apache.org/jira/browse/STDCXX-635
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 23. Containers
    Affects Versions: 4.2
         Environment: All
            Reporter: Farid Zaripov
            Priority: Minor
             Fix For: 4.2.1


The program below aborts on assert.

#include <deque>
#include <cassert>

int main ()
{
    typedef std::deque<int> Deque;
    typedef Deque::iterator Iter;

    Deque d1, d2;

    Iter iters [2][2] = {
        { d1.begin (), d1.end () },
        { d2.begin (), d2.end () }
    };

    d1.swap (d2);

    assert (d2.begin () == iters [0][0]);
    assert (d2.end ()== iters [0][1]);
    assert (d1.begin () == iters [1][0]);
    assert (d1.end ()== iters [1][1]);

    return 0;
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message