Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2005-02-07 09:35:43

On 2/1/05 1:49 PM, "Gennadiy Rozental" <gennadiy.rozental_at_[hidden]>

>>>> BTW, why would you need to do this unusual kind of multiple restoring in
>>>> the first place?
>>> I want to save state of cout (or any other current log/report stream for
>>> that matter) at the start of test case/framework run and restore it after
>>> each assertion?
>> What's wrong with wrapping each trial in a block?
> I do not want to waste time on save every time. I already do this for
> restore. I guess it's not that big deal. What I want ot do though it reset
> stream from within Boost.Test code. I guess I will have to keep
> shared_ptr<saver> m_state_saver in my log and do m_state_saver.reset( new
> saver ) every time. This is kinda wastfull though: 1 extra memory allocation
> and unnneded constructor call.

I could add a public "reset" member function to do the work of undoing the
change, and simply have the destructor call that. This allows

1. Would "reset" be a good name for this member function?
2. Is it worth it to complicate the current simple-RAII interface
    for 99% of users for the sake of the 'wacky' 1% that actually
    need multi-restore?

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

Boost list run by bdawes at, gregod at, cpdaniel at, john at