Paul Brannan <pbrannan / atdesk.com> writes:

 
>     Type::const_iterator f_itor = f.begin();
>     Type::const_iterator b_itor = b.begin();
>     for(; f != f.end() && b != b.end(); ++f, ++b)
>     {
>       cout << "(" << *f << ", " << *b << ")" << endl;
>     }
> 
> However, in Ruby, aside from using weird callcc hacks, the best I can hope
> for is to use collect or to_a or something to convert the data into an
> array so that I can iterate through it.

Have you seen knu's 'iterator.rb' module in rough/lib?

     require 'iterator.rb'

     a = [ 1, 2, 3 ]
     b = %w/ant bat cat/
     c = [ /a/, /b/, /c/ ]

     IteratorGroup.new(a, b, c) do |group|
       group.each {|element| puts element.inspect }
     end

  #=>

     [1, "ant", /a/]
     [2, "bat", /b/]
     [3, "cat", /c/]


Regards


Dave