This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/31247] New: std::vector::iterator::value_type is accessible
- From: "sylvain dot pion at sophia dot inria dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2007 16:52:36 -0000
- Subject: [Bug libstdc++/31247] New: std::vector::iterator::value_type is accessible
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This is an "accepts invalid code" report.
The following code happens to compile with g++ (all versions),
whereas the standard does not guarantee it should (I think).
----------------------------
#include <vector>
typedef std::vector<int>::iterator Iterator;
Iterator::value_type v;
Iterator::pointer p;
Iterator::iterator_category c;
----------------------------
The problem is that developing code with g++, and introducing this
kind of code by mistake, pops up errors later when other compilers
are used (e.g. those which have pointers for std::vector::iterator).
Would it be a good idea to make the access to such types somehow non public?
For example by making them protected and making std::iterator_traits a friend?
Or maybe only available when _GLIBCXX_DEBUG is not defined ?
--
Summary: std::vector::iterator::value_type is accessible
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sylvain dot pion at sophia dot inria dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31247