[cfe-dev] A question about templates and best viable functions

Sebastian Redl sebastian.redl at getdesigned.at
Mon Sep 15 03:42:59 PDT 2014


On 15 Sep 2014, at 3:59, Richard Smith <richard at metafoo.co.uk> wrote:
> 
> This gives a rather different problem. In the original question, we had
> 
> MyStruct -> float* -> bool -> void func(bool)
> MyStruct -> T* (T = int) -> void func(int*)
> 
> (Note that we can't use the template for the bool overload of func, because we cannot deduce T.) In your version, we have an ambiguous conversion sequence for MyStruct and a user-defined conversion sequence for func(int*).

The struct is the template, not the conversion operator. And once the struct template is instantiated, there is no difference to a non-template struct.

Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140915/9535458d/attachment.html>


More information about the cfe-dev mailing list