Boost logo

Boost :

Subject: Re: [boost] [Exception] Why is there no non-const version of get_error_info?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-08-19 18:53:35


On Wed, Aug 19, 2009 at 3:49 PM, Steven Watanabe<watanabesj_at_[hidden]> wrote:
> 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.

Oh wow, I did not know that. Thanks for the information!

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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