[proto] Calculator Arity Transform and function varargs

Hi, I can't make it out how to do the arity transformation for proto::functions varargs too. Could anybody shed some light? Thanks and best regards, -- Felipe Magno de Almeida

(Sorry for the delay, I've been away on vacation.) Felipe Magno de Almeida wrote:
Hi,
I can't make it out how to do the arity transformation for proto::functions varargs too. Could anybody shed some light?
I think I may need more information about what you're trying to do. There is a (rather advanced) example of using the fold transform on a proto::function with varargs here: http://tinyurl.com/2l9srv. Does that help any? When dealing with varargs, the fold and reverse_fold transforms are especially handy because they iterate over the sequence of children nodes for you -- you don't have to worry about how many there are. So if you can express your transform using fold, it'll make life easier. -- Eric Niebler Boost Consulting www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com

Eric Niebler wrote:
(Sorry for the delay, I've been away on vacation.)
Felipe Magno de Almeida wrote:
Hi,
I can't make it out how to do the arity transformation for proto::functions varargs too. Could anybody shed some light?
I think I may need more information about what you're trying to do. There is a (rather advanced) example of using the fold transform on a proto::function with varargs here: http://tinyurl.com/2l9srv. Does that help any? When dealing with varargs, the fold and reverse_fold transforms are especially handy because they iterate over the sequence of children nodes for you -- you don't have to worry about how many there are. So if you can express your transform using fold, it'll make life easier.
Oh, I just noticed from the subject line that you're looking at the calculator arity transform. There is an example that shows how to do the arity calculation using fold and vararg. Look for CalculatorGrammar here: http://svn.boost.org/trac/boost/browser/trunk/libs/xpressive/proto/example/c... It is heavily commented, and shows a couple of different ways to tackle the problem. HTH, -- Eric Niebler Boost Consulting www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com

On 8/27/07, Eric Niebler <eric@boost-consulting.com> wrote:
Eric Niebler wrote:
(Sorry for the delay, I've been away on vacation.)
Lol, now was I on vacation. [snip]
Oh, I just noticed from the subject line that you're looking at the calculator arity transform. There is an example that shows how to do the arity calculation using fold and vararg. Look for CalculatorGrammar here:
http://svn.boost.org/trac/boost/browser/trunk/libs/xpressive/proto/example/c...
It is heavily commented, and shows a couple of different ways to tackle the problem.
It was *exactly* what I was looking for. Thanks.
HTH,
-- Eric Niebler Boost Consulting www.boost-consulting.com
The Astoria Seminar ==> http://www.astoriaseminar.com
Best regards, -- Felipe Magno de Almeida
participants (2)
-
Eric Niebler
-
Felipe Magno de Almeida