|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-11-08 22:19:28
Tobias Schwinger <tschwinger_at_[hidden]> writes:
> Well then, (it was actually half a joke, but) time to attend to duty
> (: I tried a different algorithm: Traversal of an imaginary,
> linearized tree.
Looks interesting... but I don't get it :)
> It does not have the "comma limitation" but surprisingly (for me, at
>least) it runs awfully slow. I believe it's still worth a post and
>I'd be most thankful for a hint on what causes the poor performance.
Well, here's another, with no comma limitation, and it seems plenty
fast. It's based on the enclosed Python program. Unfortunately I
found the way that BOOST_PP_FOR works made the translation a little
hard; it's something like:
for(;;)
MACRO(state);
cont = PRED(state);
state = NEXT(state);
if !(cont) break;
I got a bit tangled up in trying to unwind my Python code to fit
BOOST_PP_FOR in this case. Maybe you can do better.
==== add.py =====
==== add.cpp =====
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk