(ref.doc)horstman 140395
Next clamage 140395
Prev: rmartin 060395
Up: Usenet
From: [email protected] (Cay Horstmann)
Newsgroups: comp.std.c++
Subject: Re: STL iterator model
Date: 14 Mar 1995 15:32:48 GMT
John Max Skaller ([email protected]) wrote:
: 	If anything, the conversion
: 	operator bool()const
: would make more sense in cases like
: 	while(it) { ..}
Wasn't it some C++ programmer who said that those who forget their 
history are condemned to repeat it? 
There is a reason why one converts to void* to test for truth values.
Of course, a conversion to bool would be the more logical approach, but it
would make a lot of expressions compile with nonsensical meanings. Consider
	container<T>::iterator it1, it2, it3;
	if (it1 == it2 + it3) ...
for iterators or
	cin << 10
for streams. This is because bool->int remains an implicit conversion.  
automatically generated by info2www version 1.2.2.8