public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/27404]  New: Rope iterators are not InputIterators
@ 2006-05-02 21:43 doug dot gregor at gmail dot com
  2006-05-03  0:08 ` [Bug libstdc++/27404] " pcarlini at suse dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: doug dot gregor at gmail dot com @ 2006-05-02 21:43 UTC (permalink / raw)
  To: gcc-bugs

Rope iterators (both const and mutable) do not meet the requirements of an
Input Iterator, because their dereference operator only operates on non-const
objects. Table 72 of the C++98 Standard requires the valid expression *a, where
a is a const iterator, but this valid expression does not work with a non-const
operator*.

To fix, make operator* and everything it relies on "const". This might have an
unfortunate ripple effect; an alternative (but ugly) approach would be to add a
new operator* to _Rope_iterator and _Rope_const_iterator that const_cast's and
forwards:

  reference
  operator*() const
  {
    return *const_cast<_Rope_iterator&>(*this);
  }

  reference
  operator*() const
  {
    return *const_cast<_Rope_const_iterator&>(*this);
  }

This problem is very unlikely to cause problems in user code, but it makes
ConceptGCC sad.


-- 
           Summary: Rope iterators are not InputIterators
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: doug dot gregor at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27404


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-05-04  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-02 21:43 [Bug libstdc++/27404] New: Rope iterators are not InputIterators doug dot gregor at gmail dot com
2006-05-03  0:08 ` [Bug libstdc++/27404] " pcarlini at suse dot de
2006-05-04  9:39 ` paolo at gcc dot gnu dot org
2006-05-04  9:40 ` pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).