| Author |
Message |
Rolf Magnus *nix forums Guru
Joined: 21 Feb 2005
Posts: 1236
|
Posted: Fri Jul 21, 2006 2:20 pm Post subject:
Re: iterator vs const_iterator
|
|
|
Bit byte wrote:
| Quote: | whats the difference - apart from what the name suggests?
- i.e. one is const
|
It isn't const. It's used to access an element of a container as constant.
| Quote: | What are there pros and cons of using one over the other ?
|
Pretty much the same as with any other use of constants.
The advantage of the regular iterator is that you can modify objects through
it. The advantage of the const_iterator is that you can use it to access
elements of a container that is const. |
|
| Back to top |
|
 |
Victor Bazarov *nix forums Guru
Joined: 07 Apr 2005
Posts: 3949
|
Posted: Fri Jul 21, 2006 2:10 pm Post subject:
Re: iterator vs const_iterator
|
|
|
Bit byte wrote:
| Quote: | whats the difference - apart from what the name suggests? - i.e. one
is const
What are there pros and cons of using one over the other ?
|
http://www.aristeia.com/Papers/CUJ_June_2001.pdf
And check out the rest: http://www.aristeia.com/publications.html
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask |
|
| Back to top |
|
 |
Bit byte *nix forums beginner
Joined: 23 Mar 2006
Posts: 33
|
Posted: Fri Jul 21, 2006 2:10 pm Post subject:
iterator vs const_iterator
|
|
|
whats the difference - apart from what the name suggests? - i.e. one is
const
What are there pros and cons of using one over the other ? |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|