This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
multiset forward iterator is const
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: multiset forward iterator is const
- From: Matthias Klose <doko at cs dot tu-berlin dot de>
- Date: Wed, 10 Nov 1999 18:46:42 +0100 (MET)
- CC: 36600 at bugs dot debian dot org, David Marwood <marwood at infranetsolutions dot com>
[This behaviour (or a possible misinterpretation of the standard) was
reported to the Debian bug tracking system. You can find further
information at http://www.debian.org/Bugs/db/36/36600.html]
gcc version 2.96 19991021 (experimental)
"The Dec 2, 1996 draft of the "Working Paper for Draft Proposed
International Standard for Information Systems Programming Language
C++" says that the multiset must support forward iterators. A forward
iterator's operator* must return a reference (T&). The implementation
in libstdc++2.9-dev multiset.h returns a const reference (const T&).
This is not correct."
#include <multiset.h>
int main(void)
{
multiset<int, less<int> > x;
x.insert(5);
multiset<int, less<int> >::iterator iter = x.begin();
int& y = *iter;
}
[patricia:~]g++ test.cpp
test.cpp: In function `int main(...)':
test.cpp:8: warning: conversion from `const int' to `int &' discards const