Remove inline sorting algorithms from core headers

This commit is contained in:
Andrey Kamaev
2013-03-28 16:12:13 +04:00
parent 20534c9beb
commit cc6bdfb045
19 changed files with 139 additions and 577 deletions

View File

@@ -2393,7 +2393,7 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
for( j = 0; j < len; j++ )
ptr[j] = ((const T*)(src.data + src.step*j))[i];
}
std::sort( ptr, ptr + len, LessThan<T>() );
std::sort( ptr, ptr + len );
if( sortDescending )
for( j = 0; j < len/2; j++ )
std::swap(ptr[j], ptr[len-1-j]);
@@ -2403,6 +2403,15 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
}
}
template<typename _Tp> class LessThanIdx
{
public:
LessThanIdx( const _Tp* _arr ) : arr(_arr) {}
bool operator()(int a, int b) const { return arr[a] < arr[b]; }
const _Tp* arr;
};
template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
{