Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 2000-02-02 10:12:27

John Maddock wrote:

> Valentin -
> >> template <typename T, typename U>
> >> void fill(myUDT<T>*, myUDT<T>*, const U&){}
> > ^
> >add <myUDT<T>*, U> here
> No! if we could do that (partially specialise a function template) then
> this discussion wouldn't have started.
> >> void foo()
> >> {
> >> std::fill<char*, char >(0, 0, 0); // ambiguous
> >
> >You don't mean char*, do you ?
> Sure I do, as in std::fill<iterator, T>, and char* sure is an iterator?
> :-)

char* sure isn't convertible to myUDT<T>* ?

I fail to see how your overload introduces a problem here.

> >That's correct. It would basically imply that lib code
> >cannot use standard lib templates or function, only
> >non-standard ones. And that's _not_ what we wanted. YADR.
> Not just standard library code, I chose that as an extreme example - if you
> overload in std then legal code may not compile, whether it is user code,
> in a third party library, or in the standard library itself - the point is
> that the cause of the error (the overload) is divorced from the compiler
> message - which is likely to list perfectly good code as the culprit.

The worst problem is that there is culprit at all.

> My point was that there was a suggestion to change the standard to allow
> overloading in std, IMO I prefer to rely on Koenig lookup

Which means that there is no way to override a standard
function on a generic type (aka templated type). And again
this has nothing to do w/ overloading vs. specialisation.

Valentin Bonnard

Boost list run by bdawes at, gregod at, cpdaniel at, john at