Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

array::iterator

The type of an iterator for the controlled sequence.

typedef implementation-defined iterator;

The type describes an object that can serve as a random-access iterator for the controlled sequence.

 

// std__array__array_iterator.cpp 
// compile with: /EHsc /W4
#include <array> 
#include <iostream> 

typedef std::array<int, 4> MyArray; 

int main() 
{ 
    MyArray c0 = {0, 1, 2, 3}; 

    // display contents " 0 1 2 3" 
    std::cout << "it1:";
    for ( MyArray::iterator it1 = c0.begin(); 
          it1 != c0.end(); 
          ++it1 ) {
       std::cout << " " << *it1; 
    }
    std::cout << std::endl; 

    // display first element " 0" 
    MyArray::iterator it2 = c0.begin(); 
    std::cout << "it2:";
    std::cout << " " << *it2; 
    std::cout << std::endl; 

    return (0); 
} 
it1: 0 1 2 3 it2: 0

Header: <array>

Namespace: std::tr1

Community Additions

ADD
Show:
© 2015 Microsoft