Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2007-02-16 16:44:22


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?

Matthias


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