Well...depending on the type of the array. In case you are using STL containers then take a look at the following algorithms:
copy (for unsorted ranges)
merge (for sorted ranges)
set_union (for sorted ranges - elements in both source ranges end up only once in destination range)
set_intersection (for sorted ranges - only elements that are in both source ranges)
Edit: Okay....I guess, I actually misunderstood the question...if you want to make one array equal to the other, then the 'copy' algorithm is actually the one you are looking for (which can even be used with POD types). The other three are actually used for merging. Sorry for not paying attention in the first place and thanks to Lindley for giving me the wake up.
Last edited by Andreas Masur; January 10th, 2009 at 11:45 PM.
Reason: Brain cells were already sleeping....
"Software is like sex, it's better when it's free." - Linus Torvalds
In the event the array is of a plain-old-data type, you can always use memcpy(). std::copy() should be preferred, though, since it (probably) reduces to memcpy() in the POD case, while also correctly handling non-POD types.