let's break up that line you have in the end:

int(*f)(char) = (int(*)(char))foo<char> ;
f('a') ;

it becomes clear that f has a return type of int. So the ambiguity is
resolved...
Anil


On Tue, May 25, 2010 at 2:25 PM, Anil C R <cr.a...@gmail.com> wrote:
>
> Out of curiosity why would you do something like this?
> Anil
>
>
> On Tue, May 25, 2010 at 12:45 PM, Modeling Expert <
cs.modelingexp...@gmail.com> wrote:
>>
>> If we have templatized functions , return type becomes part of
>> function signature ( which is not the case when we have normal non-
>> templatized functions ) , So we can have two functions like these who
>> differ only in return type
>>
>> template<class T> int foo(T)
>> { cout << " this " ; }
>>
>> template<class T> bool foo(T)
>> { cout << " that " ; }
>>
>> Questions is how do I call these functions. If I do like these
>> int k = foo<int>(12) ; it cribbs that this call is ambiguos. How do we
>> avoid this ambiguity  ??
>>
>> On googling it I could find one cast which solves this , but I could
>> not understand it fully
>>    ((int(*)(char))foo<char>)('a');
>>
>> Can some one explain in simple terms.
>>
>> -Manish
>>
>> --
>> You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
.
>> For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to