M
ManicQin
Hi all.
I need a fast help,
I have a list of COperation* and I add Operations, each Operation has
a scale and before I execute the list i want to sort them
I have the next snip:
class COperation
{
public:
virtual int GetScale() const { return -1; }
};
typedef COperation* PCOperation;
typedef std::list<PCOperation> tOpStack;
struct greaterScale : public std::greater<PCOperation>
{
bool operator()(const PCOperation& x,const PCOperation& y)
{
if (x->GetScale() != -1 && y->GetScale() != -1 && y->GetScale() > x-
return true;
}
return false;
}
};
later I try to call:
tOpStack m_OpStack;
m_OpStack.sort(greaterScale());
when I enter the sort I see that instead of using my greaterScale pred
he is using the normal greater pred...
I'm guessing that my greaterScale isn't using the correct signature
and the compiler cant deduce the correct operator()
but why? what am I doing wrong?
thanks....
I need a fast help,
I have a list of COperation* and I add Operations, each Operation has
a scale and before I execute the list i want to sort them
I have the next snip:
class COperation
{
public:
virtual int GetScale() const { return -1; }
};
typedef COperation* PCOperation;
typedef std::list<PCOperation> tOpStack;
struct greaterScale : public std::greater<PCOperation>
{
bool operator()(const PCOperation& x,const PCOperation& y)
{
if (x->GetScale() != -1 && y->GetScale() != -1 && y->GetScale() > x-
{GetScale())
return true;
}
return false;
}
};
later I try to call:
tOpStack m_OpStack;
m_OpStack.sort(greaterScale());
when I enter the sort I see that instead of using my greaterScale pred
he is using the normal greater pred...
I'm guessing that my greaterScale isn't using the correct signature
and the compiler cant deduce the correct operator()
but why? what am I doing wrong?
thanks....