Something about iterator base class in STL

I browsed one of the pages in the reference column and find the definition of base_iterator class template like following:
template <class Category, class T, class Distance = ptrdiff_t,
class Pointer = T*, class Reference = T&>
struct iterator {
typedef T value_type;
typedef Distance difference_type;
typedef Pointer pointer;
typedef Reference reference;
typedef Category iterator_category;
};

One thing I can't understand is the "class Distance=ptrdiff_t" in the parameter list. It seems this type "ptrdiff_t" is undefined...or is it some type name predefined in C++(just like int, float, etc.)?
See http://cplusplus.com/reference/clibrary/cstddef/ptrdiff_t/

As for where it is defined...I have no idea.
EDIT: Maybe I should look at the page I gave you you more closely >_>

It says it is defined in <cstddef>
Last edited on
Topic archived. No new replies allowed.