Strange Template error : error C2783: could not deduce template argument
Posted
by osum
on Stack Overflow
See other posts from Stack Overflow
or by osum
Published on 2010-05-27T11:22:04Z
Indexed on
2010/05/27
11:31 UTC
Read the original article
Hit count: 229
Hi, I have created a simple function with 2 diffrernt template arguments t1, t2 and return type t3. So far no compilation error. But when Itry to call the function from main, I encounter error C2783. I needed to know If the following code is legally ok? If not how is it fixed? please help!
template <typename t1, typename t2, typename t3>
t3 adder1 (t1 a , t2 b)
{
return int(a + b);
};
int main()
{
int sum = adder1(1,6.0); // error C2783 could not deduce template argument for t3
return 0;
}
© Stack Overflow or respective owner