I'm sorry for asking so much, but I've encountered another problem I have no idea how to solve... From what I gather, gcc fails to resolve myComparator class type, probably because the following code is not compliant with the standard. The question is if I am missing something or is there a workaround for this problem, which wouldn't require too much changes (like interfaces solution)...
template <typename DATA> class myArray
{
template <typename F> void sort (F &comp)
{
// No problems here
}
template <typename T> void sort(void)
{
T::myComparator cmp; //Error: expected `;' before 'zzz'
// T::template myComparator cmp; also doesn't work
sort(cmp);
}
};
class test
{
public:
class myComparator
{
public:
bool operator() ( const test *t1, const test * t2)
{
// No problems here
}
};
};
void testCmp()
{
myComparator cmp;
cmp.sort<test>();
}