[Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
gdr at integrable-solutions dot net
gcc-bugzilla@gcc.gnu.org
Tue Aug 3 15:19:00 GMT 2004
------- Additional Comments From gdr at integrable-solutions dot net 2004-08-03 15:19 -------
Subject: Re: can't compile self defined void distance(std::vector<T>, std::vector<T>)
"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:
| Subject: Re: can't compile self defined void distance(std::vector<T>, std::vector<T>)
|
| pcarlini at suse dot de wrote:
|
| > First, the ongoing work on type traits + tr1 may simplify
| > considerably this kind of refinements, exploting enable_if idioms.
|
| OK. Meanwhile, so that it does not seem I am here just to do FUD, this is
| another proto-patch to fix this bug. This solution seems almost perfect to me:
|
|
| template <class Iter>
| typedef typename lazy_enable_if<
| has_difference_type<iterator_traits<T> >,
| get_difference_type<iterator_traits<T> >
| >::type
| distance(Iter first, Iter last) { ... }
Please, do understand that
(1) you're changing the signature of this template function; I see
nothing in the standard that allows this transmutation. I would
welcome any quote to that effect.
(2) focusing on distance is wrong: It is just the tip of the iceberg.
[...]
| > Second, if we really want to go this way, we should do it
| > consistently: don't you believe that most definitely *many* other
| > places of the library could be amenable to this treatment?
|
| I don't know how many off-hand.
Every places where the constraints on the template parameter are in
comments, not in actual codes. And there are lots of them.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910
More information about the Gcc-bugs
mailing list