fork download
  1. #include <boost/lexical_cast.hpp>
  2. #include <string>
  3. #include <stdexcept>
  4. #include <iostream>
  5. int N_size_file = 5000;
  6. int N_MAX = 4500;
  7. void f()
  8. {
  9. if(N_size_file > N_MAX)
  10. throw std::runtime_error( "check(): Hidden node count of "
  11. + boost::lexical_cast<std::string>(N_size_file)
  12. + " exceeds maximum allowed value of "
  13. + boost::lexical_cast<std::string>(N_MAX));
  14. }
  15. int main()
  16. {
  17. try {
  18. f();
  19. } catch(const std::exception& e) {
  20. std::cout << "Caught exception: " << e.what() << '\n';
  21. }
  22. }
Success #stdin #stdout 0.01s 2864KB
stdin
Standard input is empty
stdout
Caught exception: check(): Hidden node count of 5000 exceeds maximum allowed value of 4500