
Joel Falcou wrote:
Hello,
I'm currently trying to grasp the way proto trasnform are supposed to work and I was wondering fio there is any use cases or examples of how and why a Visitor can be used.
Hi, In the proto/v4 branch, "Visitor" has been renamed "Data" to more accurately reflect its role as a blob of user-specified data to be passed along to each transform. A very simple example is a lambda library with placeholders. Imagine you wrote a transform that evaluated lambdas with arguments. When evaluating a lambda expression such as (_1 + _2) with the arguments (3,4), you might pass the arguments to the transform as a tuple in the Data parameter (a.k.a Visitor). Then, when the transform has recursed to a placeholder terminal, say _1, the result would be the 0th element in the Data tuple. I have reimplemented the Boost Lambda Library on top of proto using this technique. You can find it here: http://svn.boost.org/trac/boost/browser/branches/proto/v4/libs/proto/example... HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com