From: John Maddock (john_at_[hidden])
Date: 2006-03-16 05:19:08
> Is it really a bug?
> AFAIK, the compiler is ordered to apply template function "distance"
> on two members of the class. The function is const, so the members
> must be const, in this case its final type will be "const char *
> const". So the template deduced automatically will have the type
> "const char * const" as "InputIterator", which is not a valid input
> iterator, as it may not step forward or backward.
There is a rule in template type deduction that the final const gets
template <class T> foo(T z);
const int j;
foo(i); // calls foo<int>
foo(j); // also calls foo<int>
This is to ensure consistency with non-template function calls, and also
makes sense once you realise that foo<int> and foo<const int> would have the
same signature and type anyway.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk