LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   vector copying speed comparison (https://www.linuxquestions.org/questions/programming-9/vector-copying-speed-comparison-383348/)

gecoool 11-15-2005 09:26 AM

vector copying speed comparison
 
Which sequence is faster to copy one vector to another:
using for ..., or using iterators ?

1. copy (v_src.begin(), v_src.end(), back_inserter(v_dest));

OR

2.
v_dest.resize(v_src.size());
for(unsigned i=0;i<v_src.size();i++)
v_dest[i] = v_src[i];

dmail 11-15-2005 10:34 AM

Hmmm ;(
why don't you time the operations?

on second thoughts i'm not familar with the func copy() and i can't find it in stroustrup's book??


All times are GMT -5. The time now is 08:29 PM.