Template compiling errors on iPhone SDK 3.2
- by Didier Malenfant
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