cancel
Showing results for 
Search instead for 
Did you mean: 

Error C2782 'void touchgfx::Line::setLine(T,T,T,T)': template parameter 'T' is ambiguous

ferro
Senior II

Hi Gfx Team,

When I try to call Line::setLine ()

touchgfx::Line line {};
line.setLine ( .5f, 7, 5.5, 7 );

my MSVC compiler says

Error	C2672	'touchgfx::Line::setLine': no matching overloaded function found
Error	C2784	'void touchgfx::Line::setLine(T,T,T,T)': could not deduce template argument for 'T' from 'int'
Error	C2782	'void touchgfx::Line::setLine(T,T,T,T)': template parameter 'T' is ambiguous
Error (active)	E0304	no instance of function template "touchgfx::Line::setLine" matches the argument list

 

I tried and it seems to help when Line::setLine () is defined like this:

template <typename T1, typename T2, typename T3, typename T4>
void setLine(T1 startX, T2 startY, T3 endX, T4 endY)
{
    setStart(startX, startY);
    setEnd(endX, endY);
}

template <typename T1, class T2>
void setStart(T1 x, T2 y)
{
    setStart(CWRUtil::toQ5<T1>(x), CWRUtil::toQ5<T2>(y));
}

etc.

 

Do you think you could change function templates to this form ?

Thanks

Ferro

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @ferro ,

I see the issue you are mentioning, but changing that template variable will require more treatment than what it appears. Therefore, I would suggest using all floating numbers in your case, so it would be: 

line.setLine ( 0.5f, 7.0f, 5.5f, 7.0f );

 

I hope this helps you,
Good luck

Mohammad MORADI
ST Software Developer | TouchGFX

View solution in original post

1 REPLY 1

Hello @ferro ,

I see the issue you are mentioning, but changing that template variable will require more treatment than what it appears. Therefore, I would suggest using all floating numbers in your case, so it would be: 

line.setLine ( 0.5f, 7.0f, 5.5f, 7.0f );

 

I hope this helps you,
Good luck

Mohammad MORADI
ST Software Developer | TouchGFX