Boost logo

Boost Users :

Subject: [Boost-users] [proto] problem with templated recursive transform
From: Daniel Oberhoff (daniel.oberhoff_at_[hidden])
Date: 2009-02-05 04:28:03


Hi,

I have gotten my hands pretty dirty with my array expression DSEL, and
hove gotten surprisingly far (surprisingly considering the amounts of
black template magic involved :) ).

Now I am stuck with a templated recursive transform, that I cant seem to
get right. Here is a stripped down version:

template<typename T, typename IndexSet>
struct ExpressionIteratorBuilder
 : proto::or_<
     proto::when<
       cpudata_indexing_grammar< proto::_ > ,
       TerminalIteratorBuilder<T, IndexSet>( proto::_ )
>
     ,proto::when<
                                                                
       proto::unary_plus< cpudata_grammar > ,
       ExpressionIteratorBuilder<T, IndexSet>( proto::_left )
>
>
{};

so what does work is when I have the first case (i.e. the expression is
just an indexed array terminal), but the second case, where it recurses
breaks on instantiation. I have tried all the tricks from the proto
docs, i.e. adding a dummy callable template parameter, specializing
boost::proto:::is_callable, and wrapping the recursion in proto::call,
always the same long error. It also works when ExpressionIteratorBuilder
is not a template, though that would not make it very useful.

Any ideas?

Otherwise I am beginning to love proto, and am looking forward to c++0x
when the error messages might become readable through concepts :).

Best

Daniel

-- 
---
Daniel Oberhoff
Fraunhofer FIT
Schloss Birlinghoven
53754 Sankt Augustin, Germany
Tel.: +49-(0)-2241-14-3486
Fax.:+49 (0) 2241/14-2080

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