Slide 10
Slide 10 text
Literal Containers
void cpp03()!
{!
// the old crappy way!
vector my_ints;!
for (int i=0;i<10;i++)!
my_ints.push_back(i);!
for (vector::iterator it=my_ints.begin(); it != my_ints.end(); ++it)!
cout << *it << endl;!
}!
!
void cpp11()!
{!
// how’d your literal initialization game come up?!
vector my_ints = {1,2,3,4,5,6,7,8,9,10};!
// ayo java peep this:!
for (auto i: my_ints)!
cout << i << endl;!
}!
!
void literal_maps()!
{!
// maps and tuples too!
map my_map = {{"foo", "bar"}, {"baz", "quux"}};!
! tuple = …;!
}