error2.cpp

We use cookies. Read the Privacy and Cookie Policy

error2.cpp

#include ‹stl.h›

// Compile this code with the symbol OS_USE_EXCEPTIONS defined.

int main() {

 vector‹int› v;

 try {

  v.pop_back(); // Generates an exception.

 } catch (const char* str) {

  cout ‹‹ "Caught exception " ‹‹ str ‹‹ endl;

 }

 return 0;

}