Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
HI
 
may someone explain what is the iterator in c++ ? and when it uses and why?
 
Thanks
Posted 23-Mar-13 6:58am
hor_313632
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

A Brief description about Iterator...
http://www.cplusplus.com/reference/iterator/[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

The concept of an iterator is fundamental to understanding the C++ Standard Template Library (STL) because iterators provide a means for accessing data stored in container classes such a vector, map, list, etc.
 
You can think of an iterator as pointing to an item that is part of a larger container of items. For instance, all containers support a function called begin, which will return an iterator pointing to the beginning of the container (the first element) and function, end, that returns an iterator corresponding to having reached the end of the container. In fact, you can access the element by "dereferencing" the iterator with a *, just as you would dereference a pointer.
 
To request an iterator appropriate for a particular STL templated class, you use the syntax
std::class_name<template_parameters>::iterator name
 
Take a look at this tutorial as well: http://www.cprogramming.com/tutorial/stl/iterators.html[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Rather than trying to learn the language by posting questions here, your time would be better spent reading the documentation[^] or getting hold of a book.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 25 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100