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) ? wink

Last edited by Alinor (2011-10-26 17:41:51)

Re: vector <int> ... and int [NB] ... ?

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;

Re: vector <int> ... and int [NB] ... ?

thanks for these details wink