I thought there are no differences, but I'm confused because while reading the draft of C++ standard, 24.5.1.1, reverse_iterator, I found that the reverse_iterator
is inherited from iterator
and also has explicit typedefs difference_type
, pointer
, and reference
.
template <class Iterator>
class reverse_iterator : public
iterator<typename iterator_traits<Iterator>::iterator_category,
typename iterator_traits<Iterator>::value_type,
typename iterator_traits<Iterator>::difference_type,
typename iterator_traits<Iterator>::pointer,
typename iterator_traits<Iterator>::reference> {
public:
typedef Iterator iterator_type;
typedef typename iterator_traits<Iterator>::difference_type difference_type;
typedef typename iterator_traits<Iterator>::reference reference;
typedef typename iterator_traits<Iterator>::pointer pointer;
Why is it written like this?