Name: Anonymous 2008-07-21 17:31
deque<long> test_values;
// Fill test_values with 1000000 random numbers
stack<long> test_stack;
clock_t t1 = clock();
deque<long>::iterator j = test_values.begin();
const deque<long>::iterator e = test_values.end();
while(j != e) {
test_stack.push(*j);
++j;
}
clock_t t2 = clock();Mean (t2-t1) over a couple of runs gives about 13000
But change the prefix op with a post-fix op:
while(j != e) {
test_stack.push(*j++);
}and the mean shoots up to 18000. /prog/, I ask you this: Why the fuck does it cost so much to store an additional integer?
ಠ_ಠ