vectors

This is a discussion on vectors within the C++ Programming forums, part of the General Programming Boards category; i'm new to vectors and wanted some clearification to what this says. I'm assuming I understand, but I have been ...

  1. #1
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589

    vectors

    i'm new to vectors and wanted some clearification to what this says. I'm assuming I understand, but I have been wrong before.

    Code:
    #include <vector>
    vector<int> v;
    vector<int>::iterator iter1 = v.begin();
    instansiate a vecotor, assign that vectors iterator (counter) the address of the begining of the vecotor?

    does every vector container have an iterator?

    please forgive me if i'm way off, but this is my first time even looking at a vector.
    Last edited by xddxogm3; 11-21-2005 at 06:29 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    does every vector container have an iterator?
    Yep, several. All the STL containers have at least two iterators: a regular iterator like in your code, which is read/write and a const interator which is read only:

    vector<int>::const_iterator
    Last edited by 7stud; 11-21-2005 at 08:27 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Vectors
    By naseerhaider in forum C++ Programming
    Replies: 11
    Last Post: 05-09-2008, 08:21 AM
  2. How can i made vectors measuring program in DevC++
    By flame82 in forum C Programming
    Replies: 1
    Last Post: 05-07-2008, 02:05 PM
  3. How properly get data out of vectors of templates?
    By 6tr6tr in forum C++ Programming
    Replies: 4
    Last Post: 04-15-2008, 10:35 AM
  4. How to use Vector's in C++ !?!
    By IndioDoido in forum C++ Programming
    Replies: 3
    Last Post: 10-14-2007, 11:13 AM
  5. Points, vectors, matrices
    By subnet_rx in forum Game Programming
    Replies: 17
    Last Post: 01-11-2002, 01:29 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21