error: no matching function for call to 'std::exception:exception(const char[15])'

在复现《剑指offer》代码段:

throw new exception("queue is empty");

时,遇到:

error: no matching function for call to 'std::exception:exception(const char[15])'

解决方法:

#include <stdexcept>

std::logic_error e("queue is empty");
throw std::exception(e);

 

posted @ 2019-10-07 09:36  bp9jISKIN  阅读(667)  评论(0编辑  收藏  举报