Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2007-02-16 20:30:30


"Matthias Troyer" <troyer_at_[hidden]> wrote in message
news:2BF31F01-A3AB-4B1F-9ACB-970CDF56632D_at_phys.ethz.ch...
>
> On 16 Feb 2007, at 12:19, Eric Niebler wrote:
>
>>
>>
>> Gennadiy Rozental wrote:
>>
>>> Another general comment. I personally would find single changing
>>> variable
>>> oriented interface more convenient and ore widely applicable (as
>>> opposed to
>>> the samples set). Variable could change in many ways (not only
>>> addition or
>>> subtraction, and even those could be done more conveniently with
>>> operator
>>> overloading). Essentially what I am looking for is something like
>>> this:
>>>
>>> tracked_var<....> v;
>>>
>>> v += 10;
>>>
>>> int i = v +1;
>>>
>>> v -= 5;
>>>
>>> v *= 2;
>>>
>>> cout << average( v );
>>> cout << max( v );
>>> cout << min( v );
>>>
>>> cout << max( average( v ) ) << " @" min( average( v ) ).time();
>>
>>
>> Interesting. Each mutating operation on v is considered a new sample?
>> This is a less powerful interface (no way to express covariate data;
>> eg., where is the time of each sample specified?), but might be
>> cleaner
>> for some applications. It would be pretty simple to implement such an
>> interface on top of accumulator_set.
>
> One problem I see with this is: how does the tracked_var know when to
> record the current value if it does not change? Do I need to do
>
> v += 0.
>
> if I want to enforce a sample even when the value does not change?

How do you do it with current interface?

IMO it's comparitevely rare case and both v += 0 and v = v should work.

Gennadiy


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