Roland Richter <[EMAIL PROTECTED]> writes:

> David A. Greene wrote:
>
>> The fundamental problem is that it's inconvenient to iterate through a
>> tuple.  All we have is the get<> template to access tuple elements.
>> Iterating is again conceptually simple -- just increment an index.
>> But the fact that get<> is a template implies the index must be a
>> compile-time constant, meaning we need a compile-time loop (or, if
>> you prefer, programmer-controlled loop unrolling) to iterate.
>
>   Iteration through a tuple is indeed not so simple, but *recursion*
>   is, and you can do that at runtime.
>
>   All you need is to get the head and the tail out of a tuple, and,
>   in turn construct a tuple out of head and tail. Boost.Tuple provides
>   that: "get_head()" and "get_tail()", although it is not mentioned
>   in the docs (why?).
>
>   I'm not sure whether I completely understand what you need (did I?),
>   but here is how I'd do it. Anyway, the idea of "iterating" through
>   a tuple - and also the spanning_iterator thing - sounds interesting.

See also

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/boost/boost/boost/python/detail/def_helper.hpp

which does some similar things, except with a compile-time criterion.

-- 
                       David Abrahams
   [EMAIL PROTECTED] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to