template<typename _It>
double Alg(_It it1, _It it2)
{
return AlgInternal(
it1,
it2,
std::iterator_traits<_It>::iterator_category()
);
}
template<typename _It>
double AlgInternal(
_It it1,
_It it2,
std::random_access_iterator_tag
)
{
// Makes use of random access iterator properties
}
template<typename _It>
double AlgInternal(
_It it1,
_It it2,
std::forward_iterator_tag
)
{
// Uses only forward iterator properties
}
End of Listing