|
Boost : |
Subject: Re: [boost] [any] boost::get style accessors
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2010-04-29 11:50:59
On Thu, Apr 29, 2010 at 1:10 PM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
> Christoph Heindl wrote:
>> On Wed, Apr 28, 2010 at 8:00 PM, Stewart, Robert
>> <Robert.Stewart_at_[hidden]> wrote:
>>
>> > At that point, I think they should be on par with any_cast
>> > rather than built on any_cast so that exceptions needn't be
>> > translated. Exception handling overhead is too costly to do
>> > it twice when it isn't necessary.
>>
>> I agree. I don't see any added value by using bad_get, except all
>> boost:get accessors would throw bad_get exceptions.
>
> Perhaps you missed my point. I was suggesting that your gets be implemented at the same level of access as any_cast so no exception translation were needed. In other words, take code straight from any_cast and use it to implement get, provided bad_cast is deemed useful.
Indeed I did. In boost 1.42 this corresponds to duplicating ~40 lines
of code to exchange the type of exception thrown. I'm not too keen of
doing this (not talking about the tests I would have to duplicate too)
:) Of course, code could be refactored to refer to a common set of
methods that take the exception to throw as templated argument, if
desired.
Best Regards,
Christoph
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk