Boost logo

Proto :

Subject: Re: [proto] Nested Types in Transforms
From: Eric Niebler (eric_at_[hidden])
Date: 2011-02-16 23:53:54

On 2/16/2011 10:23 PM, Hossein Haeri wrote:
> Hi Eric,
>> When you access a member of a class template, it causes the
>> template to be instantiated. CanBeCalled cannot legally be
>> instantiated with two function types. Hence the error.
> Function types? Are you really speaking of types of ordinary C++
> functions? If so, I have to say that, by coincidence, I had not
> passed any function types at all. Or, am I missing anything here?

You did. Look again:


What do you think _value(_right) and EmtnTermOrGram(_left) are?

>> Also, proto::if_ takes as it's template parameter a Transform. It
>> should be a transform that evaluates to a compile-time Boolean.
> So, this problem can simply be solved by replacing the '::type' part
> in my code with '()' in CanBeCalled<...>() even despite the fact that
> I never designed my CanBeCalled<> to be a transform?

Yes. That makes it an ObjectTransform. Check the docs for
ObjectTransform and proto::make.

>> You can easily solve both problems by making the parameter to if_
>> an ObjectTransform, as follows:
> <snip>
> Unfortunately, this didn't quite help. Despite the fact that
> EmtnShiftFObjGram itself does compile, GCC 4.5.1 (under MinGW32,
> WinXP, SP3) fails to compile all the code I like. Here are my test
> cases, where the line annotated with *** doesn't compile. The error
> message I get can be found in the PS:

I don't know, and without a complete example that I can compile, I can't
help you further. And a warning: I'm completely swamped with work and am
not likely to be much help in the near future. Maybe you post your code
to the proto list (cross-posting) and someone can chime in there.

Eric Niebler
BoostPro Computing

Proto list run by eric at