what does this declaration mean? exception() throw()

后端 未结 5 1173
暗喜
暗喜 2021-01-12 05:34

std::exception class is defined as follows

exception() throw() { }
virtual ~exception() throw();
virtual const char* what() const throw();

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-12 05:58

    Can throw() take parameters?

    Yes it can be used to declare what parameteres the method is allowed to throw.

    Also the destructor is marked as throw(), destructors should never ever throw exceptions as they may already be executing in the context of a thrown exception.

提交回复
热议问题