I thought exceptions imposed a bit more on the thrown type than the standard actually imposes. I want to clear up this confusion. What is actually imposed on those types?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The C++ ISO spec, §15.1/3, states that
From this, it seems that you should be able to throw anything you’d like, as long as you’re not throwing a type that you’ve only forward-declared.
EDIT: As @Billy ONeal points out, the type must be copyable, which means that it should support a copy constructor.