stl_tree.h: Make operators !=, == type safe for map, set.

2000-09-07  Brad Garcia  <bgarcia@laurelnetworks.com>

	* bits/stl_tree.h: Make operators !=, == type safe for map, set.
	* testsuite/23_containers/set_operators.cc: New file. Should not
	compile.
	* testsuite/23_containers/map_operators.cc: New file. Ditto.

From-SVN: r36247
This commit is contained in:
Brad Garcia 2000-09-07 21:08:59 +00:00 committed by Benjamin Kosnik
parent 3eea1aed40
commit 3a664f1601
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2000-09-07 Brad Garcia <bgarcia@laurelnetworks.com>
* bits/stl_tree.h: Make operators !=, == type safe for map, set.
* testsuite/23_containers/set_operators.cc: New file. Should not
compile.
* testsuite/23_containers/map_operators.cc: New file. Ditto.
2000-09-06 Richard Henderson <rth@cygnus.com>
Benjamin Kosnik <bkoz@cygnus.com>

View File

@ -184,13 +184,15 @@ struct _Rb_tree_iterator : public _Rb_tree_base_iterator
}
};
inline bool operator==(const _Rb_tree_base_iterator& __x,
const _Rb_tree_base_iterator& __y) {
template <class _Value, class _Ref, class _Ptr>
inline bool operator==(const _Rb_tree_iterator<_Value, _Ref, _Ptr>& __x,
const _Rb_tree_iterator<_Value, _Ref, _Ptr>& __y) {
return __x._M_node == __y._M_node;
}
inline bool operator!=(const _Rb_tree_base_iterator& __x,
const _Rb_tree_base_iterator& __y) {
template <class _Value, class _Ref, class _Ptr>
inline bool operator!=(const _Rb_tree_iterator<_Value, _Ref, _Ptr>& __x,
const _Rb_tree_iterator<_Value, _Ref, _Ptr>& __y) {
return __x._M_node != __y._M_node;
}