Boost logo

Boost :

Subject: Re: [boost] [Exception] Why is there no non-const version of get_error_info?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-08-19 18:49:12


AMDG

Emil Dotchevski wrote:
> On Wed, Aug 19, 2009 at 5:14 AM, Adam Badura<abadura_at_[hidden]> wrote:
>
>> This is especially strange because operator << can be used to add data to
>> a const exception object so I don't see reason for not being able to get
>> modifiable data back (at least from non-const exception object).
>>
>
> Adding error info is supported for const exceptions because it isn't
> stored in the exception object itself, it's stored in a separate
> object the exception points to. This arrangement can't be just an
> implementation detail because the copy constructor is required to be
> nothrow.
>
> The other reason is to support the throw foo() << my_Info() syntax.
>

If operator<< is defined as a member function then it can
take an rvalue exception and still be non-const.

In Christ,
Steven Watanabe


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