How do I use the BOOST_THROW_EXCEPTION
macro? What goes in as parameters? I have no clue and I cannot seem to find any readable examples.
You just pass an exception object to it:
BOOST_THROW_EXCEPTION(std::range_error("Index out of range"));
It will wrap the exception to make it derive from class boost::exception
(if it's not already a child of it), and add info like source file and line.
The Boost.Exception FAQ has good insights on advantages and use examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With