multiset forward iterator is const
Matthias Klose
doko@cs.tu-berlin.de
Wed Nov 10 09:54:00 GMT 1999
[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
More information about the Libstdc++
mailing list