Debian Codegraph @

yo/containers/examples/vector.cc

raw
1 #include <vector>
2 #include <iostream>
3 #include <typeinfo>
4
5 using namespace std;
6
7 int main()
8 try
9 {
10 vector<int> vi;
11
12 // vi[0] = 12; // segfaults
13 vi.at(0) = 12; // throws an exception
14 }
15 catch (std::exception const &exc)
16 {
17 cerr << typeid(exc).name() << ' ' << exc.what() << '\n';
18 }