summaryrefslogtreecommitdiff
path: root/c,cc/vector_back.cc
blob: cbc82f54c4c4a94755f33c995473577d4cab92e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <vector>

using namespace std;

struct Foo {
  int i;
  char c;
};

int
main(void)
{
  vector<Foo> foo;  
  foo.push_back(Foo());
  foo.back().i = 3;
  foo.back().c = 'c';

  for (vector<Foo>::iterator it = foo.begin(); it != foo.end(); it++)
    cout << it->i << " " << it->c << endl;

  return 0;
}