// "cfa iterator.c"
// "cfa -CFA iterator.c > iterator_out.c"
// "gcc31 iterator_out.c ../LibCfa/libcfa.a"

#include "iterator.h"

/// forall( type iterator_type, type elt_type | iterator( iterator_type, elt_type ) )
/// void
/// for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) )
/// {
///   iterator_type i;
///   for( i = begin; i != end; ++i ) {
///     func( *i );
///   }
/// }

forall( type elt_type | writeable( elt_type ),
        type iterator_type | iterator( iterator_type, elt_type ),
        dtype os_type | ostream( os_type ) )
void
write_all( iterator_type begin, iterator_type end, os_type *os )
{
  iterator_type i;
  for( i = begin; i != end; ++i ) {
    os << *i << ' ';
  }
}

