[Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 3 13:04:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-08-03 13:04 -------
I am with Gaby here: if we change the signature of std::distance, then 
only to be consistent with the language standard. Now, the signature 
of the distance function is quite clearly stated in 24.3.4. I'm not 
sure we should mess with it. 
 
It is true that the given argument (here: std::vector) does not satisfy 
the requirements of an input iterator as laid out in table 72. However, 
I don't know whether the standard allows us to actually check these 
requirements on template arguments in a way that not only rejects a 
program in which they are not satisfied (this would be the case if in 
the body of the std::distance function we had concept checks that made 
sure that the type of the template argument InputIterator is really an 
input iterator, and otherwise generate a compiler error), but rather 
_reject a given function from the overload set_ and allows us to pick 
a different function. 
 
Giovanni, if you believe that such a change that make a program valid 
that was previously invalid is allowed, you should point us to the 
respective clauses of the standard that states so. 
 
W. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910



More information about the Gcc-bugs mailing list