Can somebody please help me to port the following code to GCC? I have found a lot or related questions on this site, but I just can't seem to apply suggested workarounds in my case...
typedef float MyData __attribute__ ((__vector_size__ (16)));
template <typename T> class Data_T
{
public:
template < typename U > static bool IsEqual (const T & a, const T & b)
{
return a == b;
}
//Fixed: template <> static bool IsEqual < MyData > ( const MyData & a, const MyData & b)
static bool IsEqual ( const MyData & a, const MyData & b)
{
return true;
}
void TriggerProblem(const T & val)
{
if (!IsEqual(1.0f, val)) // Error: no matching function for call to 'Data_T<float>::IsEqual(float, const float&)'
{
}
}
};
The code to trigger the problem:
Data_T<MyData> inst;
inst.TriggerProblem(1.0f);
I was getting an error error: explicit specialization in non-namespace scope 'class Data_T', which was caused by specialization function IsEqual(), but now encountered another type of error (no matching function for call to 'Data_T::IsEqual(float, const float&)'), which seems to be caused by the __vector_size__ attribute, which I can't remove. Please help...