Template compiling errors on iPhone SDK 3.2
Posted
by Didier Malenfant
on Stack Overflow
See other posts from Stack Overflow
or by Didier Malenfant
Published on 2010-05-21T16:32:57Z
Indexed on
2010/05/21
16:50 UTC
Read the original article
Hit count: 298
I'm porting over some templated code from Windows and I'm hitting some compiler differences on the iPhone 3.2 SDK.
Original code inside a class template's member function is:
return BinarySearch<uint32, CSimpleKey<T> >(key);
where BinarySearch is a method inherited from another template.
This produces the following error:
csimplekeytable.h:131: error: no matching function for call to 'BinarySearch(NEngine::uint32&)'
The visual studio compiler seems to walk up the template hierarchy fine but gcc needs me to fully qualify where the function comes from (I have verified this by fixing the same issues with template member variables that way).
So I now need to change this into:
return CSimpleTable<CSimpleKey<T> >::BinarySearch<uint32, CSimpleKey<T> >(key);
Which now produces the following error:
csimplekeytable.h:132: error: expected primary-expression before ',' token
csimplekeytable.h:132: error: expected primary-expression before '>' token
After some head scratching, I believe what's going on here is that it's trying to resolve the '<' before BinarySearch as a 'Less Than' operator for some reason.
So two questions: - Am I on the right path with my interpretation of the error? - How do I fix it?
-D
© Stack Overflow or respective owner