From 626c2cd921e7442c20ac1be7be0b9ecb44d00c95 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 6 Sep 2014 22:32:49 +0100 Subject: cc examples --- c,cc/vector_back.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 c,cc/vector_back.cc (limited to 'c,cc/vector_back.cc') diff --git a/c,cc/vector_back.cc b/c,cc/vector_back.cc new file mode 100644 index 0000000..cbc82f5 --- /dev/null +++ b/c,cc/vector_back.cc @@ -0,0 +1,24 @@ +#include +#include + +using namespace std; + +struct Foo { + int i; + char c; +}; + +int +main(void) +{ + vector foo; + foo.push_back(Foo()); + foo.back().i = 3; + foo.back().c = 'c'; + + for (vector::iterator it = foo.begin(); it != foo.end(); it++) + cout << it->i << " " << it->c << endl; + + return 0; +} + -- cgit v1.2.3