Boost logo

Boost :

From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 2007-07-31 14:09:44


> The documentation is pretty explicit about this. inserter(42,0) inserts
> a 42 at offset 0 and only at offset 0. See the section "Populating a
> Series": http://tinyurl.com/gbg8u

I read this pretty carefully before, and couldn't reach a definitive
conclusion.

If I assumed that I could use both insert(value,start) and
insert(value,start,stop) for piecewise_constant_series, and could insert
runs non-contiguously (as in the examples in the section you reference),
then I could not decide if that resulted in a piecewise_constant series
that was densely specified between the lowest and highest inserted
ordinals, or if it resulted in a sparsely specified series with zeros, in
which case I had problems seeing much difference between the
piecewise_constant and the sparse series.

I tend to be a little obtuse when it comes to inferring semantics from
examples. Your statement above is more explicit than the documentation
and all is now clear :-)

>> And as an inefficiency, each timestamp gets stored twice (again, if I
>> understand correctly).
>
> That is true. It might be useful to define a series type where the end
> of one run is implicitly the beginning of another. Such a series would
> easily fit within the framework. Any ideas what such a thing might be
> called?

piecewise_constant_dense_series? (as opposed to the current
"piecewise_constant_sparse_series"...)

> For the purposes of genericity, the inserter would still need to accept
> runs in (value, offset, end offset) tuples, though.

Of course...


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