template OutputIterator copy(InputIterator first, InputIterator last, OutputIterator result) { while (first != last) // last points one place beyond the last element of sequence to be copied *result++ = *first++; return result; // return value points to result + (last - first) } void main() { const int SIZE = 25; int numbers[SIZE] = {0,1,2,3,4,5,6,7,8,9}; float decimals[SIZE] = {0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9}; char string1[SIZE] = "STL copying is generic"; char string2[SIZE] = "Standard strcpy ain't!"; copy(&string1[0], &string1[SIZE+1], &string2[0]); // copy char array into char array copy(&numbers[0], &numbers[SIZE+1], &decimals[0]); // copy integer array into float array copy(&string1[0], &string1[SIZE+1], &numbers[0]); // copy char array into integer array }