1#include <stdexcept>
2
3#include <boost/exception/exception.hpp>
4#include <boost/throw_exception.hpp>
5
6struct hex_decode_error : virtual boost::exception, virtual std::exception {};
7struct not_enough_input : virtual hex_decode_error {};
8struct non_hex_input : virtual hex_decode_error {};
9
10void toss() { BOOST_THROW_EXCEPTION(not_enough_input()); }
11
12int main () {
13 try { toss(); }
14 catch ( const hex_decode_error & /*ex*/ ) {}
15 }
16

source code of boost/libs/algorithm/test/mclow.cpp