From bbb67405dac9fcb0c19aaa5fff295ca6fae85aae Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Tue, 2 Apr 2019 00:45:13 +0300 Subject: [PATCH] Fixed `ArgsAsList` transform to work with `cons` The `reverse_fold` requires a bidirectional sequence while `cons` is a forward sequence --- test/examples.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/examples.cpp b/test/examples.cpp index 1e77393..35769bc 100644 --- a/test/examples.cpp +++ b/test/examples.cpp @@ -178,20 +178,18 @@ struct CalcArity struct ArgsAsList : proto::when< proto::function, proto::vararg > > - /*<< Use a `reverse_fold<>` transform to iterate over the children - of this node in reverse order, building a fusion list from back to - front. >>*/ - , proto::reverse_fold< + /*<< Use a `fold<>` transform to iterate over the children of this + node in forward order, building a fusion list from front to back. >>*/ + , proto::fold< /*<< The first child expression of a `function<>` node is the function being invoked. We don't want that in our list, so use `pop_front()` to remove it. >>*/ proto::_pop_front(_) - /*<< `nil` is the initial state used by the `reverse_fold<>` - transform. >>*/ + /*<< `nil` is the initial state used by the `fold<>` transform. >>*/ , fusion::nil() /*<< Put the rest of the function arguments in a fusion cons list. >>*/ - , fusion::cons(proto::_value, proto::_state) + , proto::functional::push_back(proto::_state, proto::_value) > > {};