public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "doug dot gregor at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/27404]  New: Rope iterators are not InputIterators
Date: Tue, 02 May 2006 21:43:00 -0000	[thread overview]
Message-ID: <bug-27404-10727@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2006-05-02 21:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-02 21:43 doug dot gregor at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27404-10727@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).