stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STDCXX-769) __rw_debug_iter iterators are partially invalidated after swap() operation
Date Sun, 16 Mar 2008 23:29:24 GMT

    [ https://issues.apache.org/jira/browse/STDCXX-769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579278#action_12579278
] 

Martin Sebor commented on STDCXX-769:
-------------------------------------

Well, that sounds like a design problem with the debugging iterators. It may not be one that
can be fixed without breaking binary compatibility but I think if it is, in fact, a problem
(there's some question regarding what iterator validity means for non-invalidating operations
like {{swap()}} or {{list::splice()}}), we must fix it.

> __rw_debug_iter iterators are partially invalidated after swap() operation
> --------------------------------------------------------------------------
>
>                 Key: STDCXX-769
>                 URL: https://issues.apache.org/jira/browse/STDCXX-769
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 24. Iterators
>    Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0
>         Environment: All
>            Reporter: Farid Zaripov
>            Priority: Minor
>
> The __rw_debug_iter class contains pointer to associated container. After swap() operation
the __rw_debug_iter iterators, obtained from container method (i.e. begin()) are associated
with another container variable. Due to this any operation between iterators, obtained before
swap and after swap will fail on assert (except operator==(), maybe some others).
> The testcase:
> {code:title=test.cpp}
> #include <vector>
> #include <cassert>
> int main ()
> {
>     typedef std::vector<int> Vector;
>     typedef Vector::iterator Iter;
>     Vector v1, v2;
>     v1.push_back (1);
>     Iter v1_begin = v1.begin ();
>     v1.swap (v2);
>     assert (v1_begin == v2.begin ());
>     assert (0 == v1_begin - v2.begin ());
>     return 0;
> };
> {code}
> The testcase result:
> {noformat}
> rw/_iterbase.h:527: int __thiscall __rw::__rw_debug_iter<class std::vector<int,class
std::allocator<int> >,int *,int *>::operator -<int*>(const class __rw::__rw_debug_iter<class
std::vector<int,class std::allocator<int> >,int *,int *> &) const: Assertion
'_C_cont && _C_cont == __rhs._C_cont' failed.
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.
> {noformat}

-- 
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