| | | | | |

Generic Copy

template <class I, class J>
void g_copy (I source_beg, I source_end, J dest_beg)
{
  for ( ; source_beg != source_end; ++source_beg, ++dest_beg)
    *dest_beg = *source_beg;
}

// usage:
g_copy (L.Begin(), L.End(), V.Begin())   // copies elements of List L to Vector V
g_copy (A, A + n, L.Begin())             // copies n elements of array A to List L

| | Top of Page | 8. Generic Algorithms - 2 of 12