Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
catch is a keyword to mark a catch-block. A catch-block is always preceded by a try-block in which an exception might be thrown. The exception can be caught by the subsequent catch-block.
The code below shows the function CanLexicalCast, which returns true if a certain std::string can be converted to another data type (an int, for example). The risky operation, the conversion, is put in the try-block.
#include <cassert> |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.