Advertisement
eao197

Выброс исключения из noexcept функции

Mar 23rd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <stdexcept>
  2.  
  3. enum class result_t {
  4.     successful,
  5.     failed
  6. };
  7.  
  8. result_t external_proc();
  9.  
  10. void call_external_proc() noexcept {
  11.     const auto result = external_proc();
  12.     if( result_t::failed == result )
  13.         throw std::runtime_error( "external proc failed" );
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement