ProcessIndex( int index );
template< typename Iterator >
void ProcessIndexes( Iterator start, Iterator end )
{
while( start!=end )
{
ProcessIndex(*start++);
}
}
How can I enforce that this function can only ever be called with a specific, fixed iterator-value-type, e.g. int
(but any container-type) ? In this case, ProcessIndex()
takes an int
as input, thus, compilation fails for non-primitive types and generates a warning for e.g. float
. However, I would like the declaration to enforce int
such that the compilation fails for all but int
.
Haven't found the "solution" here or elsewhere, despite good efforts, is it trivial (?).