2

I believe this is relatively new that an iterator class is required to have the following tags at the top of the class:

using iterator_category = std::bidirectional_iterator_tag;
using value_type = T;
using difference_type = int;
using pointer = T*;
using reference = T&;

Why are these necessary and what are they doing behind the scenes? (if anything)

polar
  • 184
  • 14

1 Answers1

2

The using keyword is new in C++11.

In this instance, it's being used as a replacement for typedef.

Instead of writing:

typedef T value_type;

You can write this to get the same result:

using value_type = T;

See What is the logic behind the "using" keyword in C++? for more info.

Remy Lebeau
  • 505,946
  • 29
  • 409
  • 696
Marshall Clow
  • 15,001
  • 2
  • 27
  • 45