Issue Details (XML | Word | Printable)

Key: STDCXX-689
Type: Bug Bug
Status: Open Open
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Martin Sebor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

[LWG #280] std::reverse_iterator missing template assignment operator

Created: 08/Jan/08 01:38 AM   Updated: 11/Jul/09 12:06 AM
Return to search
Component/s: 24. Iterators
Affects Version/s: 4.1.2, 4.1.3, 4.1.4, 4.2.0
Fix Version/s: 4.3.0

Time Tracking:
Original Estimate: 2h
Original Estimate - 2h
Remaining Estimate: 2h
Remaining Estimate - 2h
Time Spent: Not Specified
Remaining Estimate - 2h

File Attachments:
  Size
Text File Licensed for inclusion in ASF works stdcxx-689.patch 2008-02-29 10:07 PM Travis Vitek 9 kB

Patch Info: Patch Available
Severity: Usability


 Description  « Hide
LWG Issue 280 added a template assignment operator to reverse_iterator:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#280

It doesn't look like we ever added the function.

I'm having trouble coming up with a test case that would reveal its absence so this is just a placeholder to remind us to look into this in more detail to make sure the function really is needed (if not, there's no need to complicate the interface of the template).



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Travis Vitek added a comment - 27/Feb/08 02:14 AM - edited
It seems that changing this would introduce a source incompatibility.
  int a [10] = {0};

  std::reverse_iterator<      int*>  rvi (&a [0]);
  std::reverse_iterator<const int*> crvi (&a [0]);
  
  // this is std::operator== (const std::reverse_iterator<int*>&, 
  //                          const std::reverse_iterator<const int*>&)
   rvi == crvi; // also for !=, <, <=, >, >= and -
  crvi == rvi;

The above code would compile with new versions of the library, but not with older versions of the library. Is this change suitable for 4.2.1? It seems that it should not be.

As an aside, I'm with John Potter on wg issues 179 and 280... I think the issue is in support of bad code. Compares should be between two iterators of the same type.


Martin Sebor added a comment - 29/Feb/08 12:23 AM
I suspect I hadn't realized issue 280 was about more than the assignment operator. Or I hadn't intended to include more than the assignment operator portion of issue 280 in this issue. Either way, I now tend to think they might as well be dealt with together. With that in mind, I agree that changing the equality operators to tale two template parameters is strictly speaking an incompatible change that would be safest to deferred until 4.3.

Travis Vitek added a comment - 29/Feb/08 10:07 PM
Added patch.

Travis Vitek added a comment - 29/Feb/08 10:08 PM
This change would not be forward source compatible. Deffered to 4.3.