I wanna sort the list with my class PrDerived. But, it doesn't occur. I think sort function creates a predicate copy and doesn't copies a virtual table. How to solve this problem ? See example:
Code:
list<int> List;
...
struct PrBase
{
virtual bool operator()(const int& a, const int& b) const
{
...
}
};
struct PrDerived : PrBase
{
virtual bool operator()(const int& a, const int& b) const
{
...
}
};
PrDerived MyDerived;
PrBase * p = &MyDerived;
List.sort( *p );
Comment