how to properly overload function templates?

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 12 06:06:33 PST 2010


On Fri, 12 Mar 2010 08:52:29 -0500, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Steven Schveighoffer:
>
>> However, I think it can be fixed, by either handling template function  
>> overloads,
>
> That's the more general solution. Do you know how much hard is to  
> implement that?
> Do you see any downsides or possible bad side effects?

I imagine it's not trivial.  You would be combining multiple templates  
into one.  At the very least, it should be restricted to a single module.   
I would restrict it also to templates that have only eponymous members  
(members of the same name).  You would also have to allow a template with  
multiple eponymous functions to resolve to the overload set of those  
functions.  The compiler currently does not allow that (or my workaround  
would have compiled).

-Steve


More information about the Digitalmars-d-learn mailing list