
----- Original Message ----- From: "Christoph Heindl" <christoph.heindl@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, April 29, 2010 5:50 PM Subject: Re: [boost] [any] boost::get style accessors On Thu, Apr 29, 2010 at 1:10 PM, Stewart, Robert <Robert.Stewart@sig.com> wrote:
Christoph Heindl wrote:
On Wed, Apr 28, 2010 at 8:00 PM, Stewart, Robert <Robert.Stewart@sig.com> 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. _______________________________________________ +1 for refactoring. Best, Vicente