This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

c++/847: templated operators in <iterator> conflict with rel_ops



>Number:         847
>Category:       c++
>Synopsis:       templated operators in <iterator> conflict with rel_ops
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 19 17:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Richard Andrews
>Release:        stdlibc++-2.90.8
>Organization:
>Environment:
i686-pc-linux-gnu (RH6.2 w/ gcc-2.95.2)
>Description:
stl_iterator.h defines templated operator!=() for iterator 
classes.
This prevents the use of std::rel_ops in any scope that 
includes <iterator>.

Also

There are logical errors in the operators. See operator<=() 
and operator>=()
>How-To-Repeat:
create a container class that defines its own iterators 
not based on std::iterator.
Also use a normal STL class with it.

If you define operator==() for the custom iterator then 
rel_ops is necessary to provide operator!=(). However if
rel_ops is visible then there is ambiguity between the 
templated operator!=() from iterator and from rel_ops.

>Fix:
Only the rel_ops operators may be templated non-members.
Templated operators in <iterator> should be made members 
of __normal_iterator.
>Release-Note:
>Audit-Trail:
>Unformatted:

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