vector copy function