mardi 17 mars 2015

trying to store time into array using chrono


I am measuring the time of an algorithm I wrote, and using std::chrono to measure it in microseconds. However, I am also trying to store these elapsed values into an array, and I'm not sure how. I tried this (my array is of type int)



std::chrono::duration_cast<std::chrono::microseconds>(end - start);


time_insertion_sort[i][j] = elapsed;


and I get the following error:


error: cannot convert 'std::chrono::duration >' to 'int' in assignment


time_insertion_sort[i][j] = elapsed;


I thought maybe it would work if I declared my array as a type long, but it still doesn't work. Can anybody help me?




Aucun commentaire:

Enregistrer un commentaire