niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » C++
iterator vs const_iterator
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Rolf Magnus
*nix forums Guru


Joined: 21 Feb 2005
Posts: 1236

PostPosted: Fri Jul 21, 2006 2:20 pm    Post subject: Re: iterator vs const_iterator Reply with quote

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

PostPosted: Fri Jul 21, 2006 2:10 pm    Post subject: Re: iterator vs const_iterator Reply with quote

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

PostPosted: Fri Jul 21, 2006 2:10 pm    Post subject: iterator vs const_iterator Reply with 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 ?
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Dec 04, 2008 7:58 am | All times are GMT
navigation Forum index » Programming » C++
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts iterator vs const_iterator Bit byte C++ 0 Fri Jul 21, 2006 2:10 pm
No new posts pointer iterator interaction silversurfer C++ 18 Fri Jun 30, 2006 10:59 am
No new posts implementing const_iterator and iterator flopbucket C++ 1 Wed Jun 21, 2006 3:24 pm
No new posts comparing iterator with const_iterator Mark P C++ 2 Wed Jun 14, 2006 5:28 pm
No new posts STL initialize iterator problem with compiler change brianhray@gmail.com C++ 4 Mon Jun 05, 2006 6:32 pm

Loans | Mortgage Calculator | Bad Credit Mortgages | Fighting Videos | Mortgage Calculator
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1077s ][ Queries: 20 (0.0360s) ][ GZIP on - Debug on ]