Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] problem with templated recursive transform
From: Daniel Oberhoff (daniel_at_[hidden])
Date: 2009-02-06 18:45:10


On 2009-02-07 00:18:05 +0100, Eric Niebler <eric_at_[hidden]> said:

> Daniel Oberhoff wrote:
>> Sorry, I had hoped there was something obviously broken. Like templating
>> a transform based on proto::or_/proto::when. I placed a zip-file here
>> with the files here:
>>
>> http://danieloberhoff.de/files/for_eric
>>
>> There are four headers and a test-suite, based on cppunit. The
>> expression that breaks is on line 59. Makefile is also there. If that is
>> too messy for you I can try to trim it down to just this problem. The
>> class that breaks is at the end of CPUDataNDExpressionIterators.hpp.
>
> I removed the dependency on cppunit (not hard), adding a missing
> #include <vector>, removed spurious semicolons after
> BOOST_PROTO_EXTENDS() and BOOST_PROTO_BASIC_EXTENDS(), and after that,
> the only problem I saw was this on line 62 of CPUDataNDExpressions.hpp:

wow, thanks for taking the time. I didnt even see those errors. maybe I
should have enabled more warnings?

>
> proto::function< proto::terminal< CPUDataND_< T > >, index_grammar,
> index_grammar, index_grammar, index_grammar, index_grammar >
>
> This requires BOOST_PROTO_MAX_ARITY to be set to 6, whereas by default
> it is set to 5. After deleting this line, everything compiles and runs
> just fine for me.

ok. will c++0x variadic templates help here?

> I'm using gcc-4.3. Much work would be necessary to
> make this work with msvc, which has a much harder time with the nested
> function types used in callable and object transforms.

Is there any other way of doing this like this? I really like callable
transforms, because they at once can synthesize types and perform
semantic actions at run-time. It really helped constructing the
expression iterators. It felt like using eval contexts would impose
much more runtime overhead and complicated type construction.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net