[PATCH] Fix PR libstdc++/13462 std::set's pointer is not right
Gabriel Dos Reis
gdr@integrable-solutions.net
Mon Dec 22 23:39:00 GMT 2003
Nathan Myers <ncm-nospam@cantrip.org> writes:
| On Mon, Dec 22, 2003 at 08:19:06AM -0800, Andrew Pinski wrote:
| > The problem is that std::set's pointer is defined based on
| > _Rep_type::const_pointer and not _Rep_type::pointer.
| > This patch fixes that and others in libstdc++.
| >
| > ChangeLog:
| > * include/bits/stl_multiset.h (__gnu_norm::multiset::pointer):
| > Define based on pointer and not const_pointer.
| > * include/bits/stl_set.h (__gnu_norm::set::pointer): Likewise.
| > * include/ext/hash_set (__gnu_ext::hash_set::pointer): Likewise.
| > (__gnu_ext::hash_multiset::pointer): Likewise.
|
| I'm not sure this is right.
It is.
| The problem is that the elements of a
| std::set<> are supposed to be immutable. Exposing a non-const pointer
| to the elements breaks that property.
This patch does not have a set returns a pointer instead of a
const-pointer. It just provides typedefs exactly as the standard
specification says. The issue of whether set elements should
be immutable (and associated DRs) or is not under discussion.
-- Gaby
More information about the Libstdc++
mailing list