Accessing the tail of a fusion::cons

140 views Asked by At

How do I officially access the tail of a boost::fusion::cons object? I know I can do it easily by accessing the cdr data member of the cons structure, but the documentation of Boost 1.54.0 doesn't specify that there is such a member, so I guess I'm not supposed to do that. at_c<1>(cons) will give me only the head of the tail, but what I need is the whole tail structure, an object of the same type as the Cdr template parameter of my cons.

I'm sorry if I'm missing something completely obvious.

1

There are 1 answers

0
niitsuma On

How about this list implementation

https://github.com/niitsuma/scm2cpp.hpp/blob/master/scm2cpp.hpp

In this implementation

cons => std::pair

car(fusion::list) => fusion::car  

cons(value , fusion::list) => fusion::list

...

and so on