
On 08/18/2005 05:08 AM, Larry Evans wrote: [snip]
Yeah, you're right. I was thinking more of how fold was done. It calculates all the intermediate results, but leaves no way to access them. That was the purpose of child_i_depth_j. I'll *eventually* try to write it the other way, but I'm not sure when. Of course someone *expert* in doing that might try ;)
Now that I think of it, the code at: http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/indexed_types/product.hpp?rev=1.2&view=auto Does that, but, unlike fold, it's specific for the factor template. In addition, it uses: TypeMap<Indices(Index-1)>::type to access the elements in the TypeSequence used to create the product (or tuple, to use the c++ standard term). Since that's O(1) time complexity, it should be no problem. Now, if we could just modify fold to do something similar. Unfortunately, the problem with fold is that the arguments of the partial result, ForwardOp<PreviousPartial,CurrentElement>, always vary; hence, they cannot be named easily with something like: factor<Indices, TypeMap, Index+1> as in product.hpp :( Maybe this would provide you (and me) with some ideas for how to do this. -best of luck Larry