I have the following compare function that I pass to the std::sort algorithm to sort a vector of objects:
template <typename PointT>
bool myCompareLines (A<PointT>::model_struct model_a, A<PointT>::model_struct model_b) {
return (/* some comparison code*/);
}
The compare function is declared outside the class and I am calling it like this:
template <typename PointT>
class B {
[...]
std::sort(lines.begin().lines.end(),::myCompareLines);
[...]
}
When I compile I get the error: template declaration of 'bool myCompareLines'
Inside class A I declare class B as a friend class so that class B can
access the the private type model_struct. What am I missing?
I was missing the typename keyword in my CompareLines signature.
This fixes it: