Jan 7, 2014 at 9:34pm Jan 7, 2014 at 9:34pm UTC
I wondered if an interator was a type? Or is it a function?
Thanks you
Jan 7, 2014 at 9:38pm Jan 7, 2014 at 9:38pm UTC
Last edited on Jan 7, 2014 at 9:39pm Jan 7, 2014 at 9:39pm UTC
Jan 8, 2014 at 12:41pm Jan 8, 2014 at 12:41pm UTC
if you look at you header files, it's something like :
1 2 3 4 5 6 7 8
template <class T, size_t size>
class array {
typedef T value_type;
typedef value_type* iterator; // <=== HERE
typedef const value_type* const_iterator;
// blah blah
};
Last edited on Jan 8, 2014 at 12:47pm Jan 8, 2014 at 12:47pm UTC
Jan 8, 2014 at 12:48pm Jan 8, 2014 at 12:48pm UTC
@Peter87 Yes, i've edited it
Jan 8, 2014 at 7:58pm Jan 8, 2014 at 7:58pm UTC
Oh so each container has its own type of iterator?
Jan 9, 2014 at 10:15pm Jan 9, 2014 at 10:15pm UTC
http://www.cplusplus.com/reference/iterator/iterator/
That link is reference to the iterator header file.
Each container class uses the iterator header file in some way to hold an iterator or multiple iterators.
If you look at any of the container references on this site, they all list what types of iterators they have available.
Edit: I attempted reading the standard library vector header file provided by MinGW and I was unsuccessful in finding out where exactly the iterator type is defined. (There is a lot of includes used in MinGW's implementation of vector.)
Last edited on Jan 9, 2014 at 10:25pm Jan 9, 2014 at 10:25pm UTC