This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Aug 2004 13:04:42 -0000
- Subject: [Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- References: <20040610143911.15910.king.benjamin@mh-hannover.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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