Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::underflow_error

 

std::underflow_error (a derived class from std::runtime_error) is thrown if a 'mathematical underflow occurs'. I did not yet succeed in producing such a mathematical underflow.

 

#include <iostream>
#include <stack>
#include <stdexcept>

int main()
{
  std::stack<int> s;

  try
  {
    //Too bad, pop does not throw std::underflow_error :-(
    s.pop();
  }
  catch (std::underflow_error& e)
  {
    //Too bad, will not get here :-(
    std::cout << e.what();
  }
}


 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict