public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/4436: const_reverse_iterator rend()const;
@ 2001-10-01 11:16 tyler
0 siblings, 0 replies; only message in thread
From: tyler @ 2001-10-01 11:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 4436
>Category: c++
>Synopsis: const_reverse_iterator rend()const;
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Oct 01 11:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Tyler Holcomb
>Release: 2.96 20000731
>Organization:
>Environment:
Red Hat Linux 7.1 2.96-81
>Description:
const_reverse_iterator rend()const;
is not defined for <vector> and <deque>, although
reverse_iterator rend(); is
>How-To-Repeat:
g++ the attached 16 line source file
>Fix:
I an new, and haven't found which directory has the source
AAARRGH. The naive answer is:
Cut & Paste the code for reverse_iterator rend(); adding const, so now the
presumably one line routine is
const_reverse_iterator() rend()const{return ??;}
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="bug_report.txt"
Content-Disposition: inline; filename="bug_report.txt"
Greetings,
I am using g++ with version:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
It appears that the function
const_reverse_interator rend() const;
has been left out of the <vector> and <deque> standard tempate libraries.
I searched the gcc bug lists but could not find the bug listed/fixed, although
these three issues from the Revision 19 list seem related (and open)
200 forward iterators don't allow constant iterators
279 const and non-const iterators should have equivalent typedefs
280 comparison of reverse_iterator to const reverse_iterator
Here is an example of my bug:
//************BEGIN SOURCE************
#include <fstream>
#include <vector>
int main()
{
vector<int> d;
for ( int i = 0; i < 5; i++)
d.push_back(i);
vector<int>::const_reverse_iterator di;
for (di = d.rbegin();
di != d.rend() ;
di++)
cout <<"\t"<<(*di);
cout << endl;
};
//************END SOURCE************
produces the following compile error:
g++ test.cpp
test.cpp: In function `int main ()':
test.cpp:12: no match for `reverse_iterator<const int *> & !=
reverse_iterator<int *>'
However, switching from const_reverse_iterator to reverse_iterator
yields a program that compiles and prints the integers 0 to 4 inclusive
in reverse order, as intended.
I hope this is useful.
In any event, thank you for your time.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-10-01 11:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-01 11:16 c++/4436: const_reverse_iterator rend()const; tyler
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).