Paul Elliott wrote:
Would it be possible to have certain obvious tuple manipulators?
For example if A and B are 2 tuples have an easy way to form the cross product of the 2 tuples?
That is if A is of length L, and B is of length M, to form the tuple C of length L+M, containing copies of the elements from both?
Also if D is a tuple of length N, and f is a functor taking N arguments (of the right types) find some way to take f(D) == f(D.get(1),D.get(2),...,D.get(N) ) Of course the ... is pseudo code. Fill in the appropriate list.
Of course I realize that limitations in the C++ language may prevent doing this for arbitrarily large L, M, or N. But it could be done for L, M, N, large enough so that it is not a practical limitation?
Sounds like a job for Fusion. This is a re-implementation of the TR tuples with iterators, views and algorithms. The structure is somewhat modeled after MPL. It is code-named "fusion" because the library is the "fusion" of compile time metaprogramming with runtime programming. The plan is to replace the old tuples lib with Fusion. Right now, it's part of Spirit (see http://www.boost.org/libs/spirit/fusion/readme.txt). There are no docs yet, but I'm struggling to get one out hopefully soon. However, should you wish to play with it, the examples in the test area is comprehensive enough to get you going. The code is fairly mature. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net