Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Re: Addable

From: Martin Sebor (sebor_at_[hidden])
Date: 2007-03-09 15:57:22


Doug Gregor wrote:
> On Mar 8, 2007, at 4:39 PM, Martin Sebor wrote:
[...]
>> FWIW, I suspect there is quite a bit of code out there (I know
>> we have some) where ordinary functions participate in the same
>> overload set as function template specializations (explicit or
>> implicit) when resolving calls from function templates. Ending
>> up with calls to different functions depending on whether the
>> call is made directly from a template or indirectly through an
>> intermediate call to a non-template overload would, IMO, be
>> surprising. This seems close to the issue we discussed at our
>> meeting (the behavior of calls to unconstrained templates from
>> constrained ones).
>
> It sounds like a similar issue, yes. Although, how often does a
> template make a call through a non-template?

You mean "from a template to a non-template?" I don't know how
common it is but in our code we tend to prefer ordinary function
overloads to explicit function template specializations for two
reasons: first can be easier on some old/broken compilers, and
second because ordinary functions let us change their signature
in advantageous ways that explicit specializations don't (e.g.,
replace the optimal generic const T& with the more efficient T
for native types).

Martin