Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] proto::reverse_fold_tree
From: Kim Kuen Tang (kuentang_at_[hidden])
Date: 2009-02-02 16:13:36


Eric Niebler schrieb:
>>
>
Ok, i have understood that child nodes must share a tag type with the
parent node as indicated by the document

 template<typename Tag, typename Fun>
struct recurse_if_ :
  proto::if_ <http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost/proto/if_.html><
    // If the current node has type type "Tag" ...
    boost::is_same<proto::tag_of <http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost/proto/tag_of.html><proto::_ <http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost/proto/_.html>>, Tag>(),
    // ... recurse, otherwise ...
    proto::fold <http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost/proto/fold.html><proto::_ <http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost/proto/_.html>, proto::_state <http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost/proto/_state.html>, recurse_if_<Tag, Fun> >,
    // ... apply the Fun transform.
    Fun
>
{};

So my next step will be to define my own fold function.
Thanks a lot to all the people here.

Cheers
Kim Tang

> My advice to you would be the same as my advice to Kim. Much can be
> done with recursion and proto::fold. Copy the implementation from
> proto::fold_tree or proto::reverse_fold_tree and modify it as needed.
>
> http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost/proto/fold_tree.html
>
>
> HTH,
>


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