Why is the second variable passed as a reference and const

Viewed 235

Why isn't first passed as a reference and const as well?

template <typename Iterator>
    int distance(Iterator first, const Iterator & last) {
    int count;
    for ( ; first != last; first++)
        count++;
    return count;
}
4 Answers
Related