// ==========================================================================
// $Id: int_vector.cpp,v 1.4 2014/10/22 20:26:07 jlang Exp $
// CSI2372 example Code for lecture 10
// ==========================================================================
// (C)opyright:
//
//   Jochen Lang
//   SITE, University of Ottawa
//   800 King Edward Ave.
//   Ottawa, On., K1N 6N5
//   Canada. 
//   http://www.site.uottawa.ca
// 
// Creator: jlang (Jochen Lang)
// Email:   jlang@site.uottawa.ca
// ==========================================================================
// $Log: int_vector.cpp,v $
// Revision 1.4  2014/10/22 20:26:07  jlang
// Update for use of array and forward_list.
//
// Revision 1.3  2009/11/16 00:42:26  jlang
// Minor touch-up
//
// Revision 1.2  2007/09/18 00:24:50  jlang
// Added comments
//
// Revision 1.1  2006/11/05 18:17:03  jlang
// Initial check-in for lecture 10
//
//
// ==========================================================================
#include <iostream>
#include <vector>

using std::cout;
using std::endl;
using std::vector;

int main( int argc, char* argv[] ) {
  // Default construction
  vector<int> iVecA;
  // Construction by constructing 100 elements all = 1
  vector<int>::size_type size = 100;
  vector<int> iVecB( size, 1 );
  // copy construction
  vector<int> iVecC( iVecB );
  // construction by copying the first 5 elements
  vector<int>::iterator iter = iVecB.begin();
  vector<int> iVecD( iter, iter + 5 );
	// list intialization
	vector<int> iVecE{0,1,2,3,4,5};

  // loop over the elements using iterators and print
  for ( vector<int>::iterator iter = iVecD.begin(); 
				iter != iVecD.end();
				++iter ) {
    // save to access *iter
    cout << *iter << ' ';
  }
  cout << endl;
  // loop over the elements using range loop
  for ( auto element:iVecE ) {
    cout << element << ' ';
  }
  cout << endl;
}
