Boost logo

Boost :

From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-08-23 00:51:25


Hello Steven,

Wednesday, August 22, 2007, 11:33:46 PM, you wrote:

> AMDG

> Andrey Semashev <andysem <at> mail.ru> writes:

>> Generally speaking, you are right here. But first, there are many
>> objects that don't throw on copying. And second, it's not always
>> possible to make a copy beforehand. See one of my previous posts for
>> an example (inserting into container yelds an iterator that is to be
>> used in the scope-exit block). So I think the best way is to leave the
>> decision up to user.

> I don't understand. Why can't you make a copy
> right before the scope exit block? I think that
> for ScopeExit, always passing by reference is
> correct. At the very least it should be the default.

I can. But this is a burden since it should be done for almost all
args I ever pass to ScopeExit. And I can easily forget to do so and
get subtle errors I pointed out before. So this is by no way should be
the default behavior.

-- 
Best regards,
 Andrey                            mailto:andysem_at_[hidden]

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