On 7/21/2010 3:51 PM, Christophe Henry wrote:
>> I was getting my A's and B's mixed up, and you're getting your A's and
>> trees mixed up. What you want is:
>> struct B
>>  : or_<
>>        when< comma< B, B >, fold_tree<..as before..> >
>>      , when< A, mpl::vector1<A>() >
>>    >
>> {};
> Argh!!! *Grumble* *Grumble*
> This is exactly the first solution I came up with (and spent a while
> on :( ) but it didn't compile because in the 2nd "when", I used
> mpl::vector<A> instead of vector1<A> and I didn't manage to figure out
> what the compile error meant. I tried the vararg and my other solution
> out of despair.

This is a gotcha, no doubt. Sorry you got bit. Happens also with
fusion::vector, so beware of templates with high arities.

> Actually it is only almost the same solution, I actually had both
> "when" in different order but I suppose in this case it doesn't
> matter, right?

No, in this case it doesn't matter.

>> Incidentally, for the "state" parameter to fold_tree, you're using
>> mpl::vector<>(). That works by luck. Because of the template arity
>> thing, proto can't pull vector<> apart to check for nested transforms
>> (but there are none anyway). You'll better express your intent with
>> mpl::vector0<>().
> Now I know it ;-)
> I think this would be a good point for a "tips and tricks section". I
> bet I won't be the last bitten by this one.

Good suggestion.

> Thanks a lot!

No prob.

Eric Niebler
BoostPro Computing

Attachment: signature.asc
Description: OpenPGP digital signature

proto mailing list

Reply via email to