I am trying to do a total template specialisation which should execute the first block of code (suffixTry
) if i > -1
else do nothing (termination condition) . Am not very sure how the last suffixTry
template should be written. When compiling, the compiler points that -1 is unknown
in the scope.
template< typename S ,typename I >
void suffixTry(S pattern, I suff[], I size, I f, I g, I i) {
suff[size - 1] = size;
if (i > g && suff[i + size - 1 - f] < i - g){
suff[i] = suff[i + size - 1 - f];
} else {
if (i < g)
g = i;
f = i;
reduceToZero(pattern, g, size, f);
suff[i] = f - g;
}
suffixTry(pattern, suff, size, f, g, --i);
}
template< typename S ,typename I>
void suffixTry(S pattern, I suff[], I size, I f, I g, -1) {
}