Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-07-16 13:26:58


Tom Brinkman wrote:
> I wonder how efficient this method to populate the "time_series" containers is?
>
> make_ordered_inserter(s)
>
> (8, 2)
>
> (6, 4)
>
> (4, 6)
>
> (2, 8)
>
> .commit();
>
> What is the preferred method to quickly populate a large number of
> data points, say in the thousands?

This is the preferred way to do it. It is algorithmically efficient
because you are inserting sorted data into a series, so it doesn't need
to do lookups. What is likely going on under the hood is a vector is
being filled. This certainly has some overhead, and I could consider
adding a reserve() customization point to the OrderedInserter concept.

> What is the preferred method to bind a structure's member variable to
> the ordered insertion list?
>
> Example:
>
> struct Foo
> {
> boost::date_time::date date;
> double high;
> double low;
> };
>
> Foo foo[10000];
>
> How would I populate and bind "foo::high" into a sparse_series?

Not 100% sure I understand the question. Is "foo::high" supposed to be
the value or the offset in the sparse series?

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com
The Astoria Seminar ==> http://www.astoriaseminar.com

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