Topic: vector <int> ... and int [NB] ... ?
Hi, I am working on some functions in c++ using array, and I wish know if "int [NB]" is really more faster than "vector <int>" (a class from vector.h) ?
Last edited by Alinor (2011-10-26 17:41:51)
You are not logged in. Please login or register.
Hi, I am working on some functions in c++ using array, and I wish know if "int [NB]" is really more faster than "vector <int>" (a class from vector.h) ?
Last edited by Alinor (2011-10-26 17:41:51)
Hi,
yes, the int array will be faster in most general cases,
there is some ways to accelerate the vector class by reserving some space etc,
so it depend what is the use of your array.
For exemple, Maratis uses vector for objects list and it's fast,
but for the mesh data, the arrays are not using arrays (lots of access etc)
You can also create a dynamic array in c++ using :
int * myArray = new [NB];
delete [] myArray;
thanks for these details
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.