Boost logo

Boost :

Subject: Re: [boost] Boost and exceptions
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-06-25 12:37:34


Emil Dotchevski wrote:
> On Sun, Jun 24, 2012 at 11:33 PM, Robert Ramey <ramey_at_[hidden]> wrote:
> <snipped code>
>
> First, as you point out, your code can't be deployed even if it was
> correct, because many compilers don't yet implement
> std::exception_ptr.

There a couple of possible answers here, but the simplest would be
just to say that you'd need to implement the standard functions for
this compiler. I cursory look at the microsoft documentation suggests
that this would be possible. and not all that difficult.

> Secondly, your program erases the type of the exception object. In
> C++, the type of the exception and not its value corresponds to its
> semantics.

hmmm looks to me that my program is not losing the type. The highest
level catch does catch the original type and just to be sure I used typeid
to print the type restored at this level. So the program output is

$ ./test_misc
caught other exception # display original exception type
caught exception_wrapper_base
caught my_exception # display exception type at highest level
999 # display attached information.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk