Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-01-30 07:54:57


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?
:-)

>
>How is it different w/ specialisation ?

specialisation is not overloading, with specialisation the address of a
template function is well defined, with overloading it's not - I would
guess that is the reasoning behind allowing specialisation in std, but not
overloading.

>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.

>???
>
>It *seems* to be correct ? How could the Standard be wrong,
>since it is the Truth ?

Ah, as in "Carved in Stone" :-)

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 and keep
overloads in their own namespaces, but I accept that that isn't perfect
either - it is standard conformant though.

- John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk