Hello again,

I would like to sort an std::vector containing pointers to SampleInCache objects, using the std::sort algorithm. But since the vector contains no objects, but pointers, I can not do that by simply overloading the <-operator of my SampleInCache class.

I tried this :

//adding this to SampleInCache.h

template <>
struct std::greater
{

bool operator()(const SampleInCache* leftVal, const SampleInCache* rightVal) const
{
//The sorting is actually more complex,
//but I first tried sorting only based on the last_time_used member of SampleInCache class
return leftVal->last_time_used < rightVal->last_time_used;
}

};

But then I get this error :
"error C2913: explicit specialization; 'std::greater' is not a specialization of a class template"

Does anyone see what I did wrong ?

Greetings,

Joanna