Alexandre C.
Alexandre C.

Reputation: 56956

Can I throw `std::bad_cast`?

Is it possible to throw an instance of std::bad_cast ? The underlying question is not whether it is good or not to do this, it is only about whether std::bad_cast has a default constructor or not.

Thanks

Upvotes: 3

Views: 1977

Answers (1)

Steve Jessop
Steve Jessop

Reputation: 279265

18.5.2 of the C++ standard says "yes", it has a no-arg constructor.

Upvotes: 7

Related Questions