Boost logo

Boost :

From: Matias Capeletto (matias.capeletto_at_[hidden])
Date: 2007-07-04 11:08:18


On 7/4/07, Giovanni Piero Deretta <gpderetta_at_[hidden]> wrote:
> On 7/4/07, Jake Voytko <jakevoytko_at_[hidden]> wrote:
> > On 7/4/07, Phil Endecott <spam_from_boost_dev_at_[hidden]> wrote:
> > >
> > > Jake Voytko wrote:
> > > > plot_range(my_plot, data.begin(), data.end(),
> > > > default_functor, human_age,
> > > > circle,
> > > > orange, red,
> > > > 3, 10);
> > >
> > > It would be great to be able to write just 'data' in place of
> > > 'data.begin(), data.end()'. Is there anything stopping this?
> >
> > The STL algorithm functions are used as the basis here, and it carries all
> > of the same benefits. First, you can select a small subset of your data if
> > you'd like that to be plotted (for example, plotting a single year out of
> > 100 years of data).
>
> You can do the same with a range based interface, you just need to
> pass to boost::make_iterator_range() the iterators defining your
> subrange.
> Most of the time you might want to plot a whole container, so the range based
> algorithm is easier to use. Not considering that you can chain the
> result of lazy
> algorithms:
>
> plot_range(my_plot, filtered(data, point_selector));

+1 for range based plot

"I want it to do this" example:
----------------------------------------------------------------
boost::bimap<float,float> bm;
assign::insert(bm) (1,123) (2,345) (3,184) (4, 256) (5, 241);
plot_range(my_plot, bm.left.range( 2 <= _key, _key < 5 ) );
----------------------------------------------------------------

Best regards
Matias


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