This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

multiset forward iterator is const


[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]