Boost logo

Boost :

Subject: Re: [boost] [proto] reorganized users' guide
From: troy d. straszheim (troy_at_[hidden])
Date: 2008-10-17 16:18:06


Eric Niebler wrote:
>
> I've just completed a major reorg of Proto's docs, with significant
> portions clarified or completely rewritten. I intend to merge these
> changes to the release branch soon. I encourage any and all interested
> parties to click around and offer feedback.

Very, very nice. And an amazing library. You could probably write an
entire book about programming inside the C++ type system that would be a
I'll be going those docs
carefully. I've been spending quite a lot of time with proto recently.
I've been doing lots of small experiments and could probably generate a lot
of little examples if you're interested.

I'm wondering... say I have a transform like:

struct Transform :
   proto::or_<
     proto::when<proto::terminal<std::vector<float> >, proto::_value>
   , proto::when<proto::terminal<float>, proto::_value>
   , proto::when<proto::binary_expr<proto::tag::multiplies, Transform, Transform>,
                Multiply(Transform(proto::_child0), Transform(proto::_child1))>
>
{};

And the idea is that the proto::callable Multiply, and its return_type,
vary depend on the evaluated types of proto::_child0, and proto::_child1.
When fully evaluated each will be either vector<float> or float,
and, say, one wants float * float to return a float, float * vector to return a vector,
and vector*vector to return some kind of matrix. I noticed the docs for lazy<>:

> lazy<> is useful as a higher-order transform, when the transform to be applied
> depends on the current state of the transformation. The invocation of the make<>
> transform evaluates any nested transforms, and the resulting type is treated as
> a CallableTransform, which is evaluated with call<>.

I could use a hint or two here...

TIA,

-t


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