Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void test(){
- try{
- if (empty())
- throw empty_list();
- std::cout << p_que.front().owner << p_que.front().price << std::endl;
- }
- catch (std::exception &e){
- std::cout << "List is empty. " << std::endl << "Error message: " << e.what() << std::endl << std::endl;
- }
- }
- #pragma once
- #include <exception>
- #include <iostream>
- class empty_list:public std::exception
- {
- public:
- const char* what() const throw(){
- return "You cannot print the list because there's nothing in it.";
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment