Boost logo

Boost :

From: Tom Brinkman (reportbase_at_[hidden])
Date: 2008-07-07 20:01:20


Joel de Guzman,

I'd like to enhance my future boost::layout library proposal
to use your boost::fusion.

Here is a simple example of the boost::layout framework, that uses
boost::gill as the view parameter.

A boost::layout functor takes the following form:

struct layer
{
    template <typename view_t>
    void operator()(view_t& view) {}
};

Examples of layers could be:

fill_layer<> fill;
border_layer<> border;
text_layer<> text;

Lets say I want to combine three layers into a single drawing
operation. Currently, I do it like this:

typedef boost::function<void (view_t&) > layer_t;

layer_t layers[] =
{
        fill_layer<>,
        border_layer<>,
        text_layer<>
}

draw_layers draw(layers,sizeof(layers)/sizeof(layer_t));

boost::gil::rgb8view_t view;
draw(view);

This works fine, but I would like to improve it by using
boost fusion. Any suggestions or hints to get me started?


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