I have a code which had a local array whose size was not known at compile time. g++ accepts this, but Solaris CC does not. So, I would like to switch this to a vector but I want to make sure that I am using vector appropriately.
The code was:
int numentries = NumEntries() ;
int MyArray[ numentries ];
sub( ..., MyArray, ... ) ;
I have converted this to:
vector <int>MyVec( numentries ) ;
sub( ..., MyVec.begin(), ... ) ;
This works, but it is portable? Is there a better way?