M
mj
Hi,
I recently have found it necessary to move from fortran to c++ for
scientific programming... I'm working on a program that needs to resize
a 2d vector of vectors within a function... This variable "tri" is an
input arg to my function using the syntax:
function(vector<vector<int> >& tri)
The problem occurs when the tri 'matrix' is resized to triple or
quadruple the originally allocated size (which I guess requires a
complete reallocation and consequently, a change in the memory address).
Just having to deal with a slew of memory allocation issues, and I
was wondering if there is a good way to resize this 2d vector other than
defining a class to contain the tri variable, and writing a resize
function within the class?
Thanks for your help!
Matt
I recently have found it necessary to move from fortran to c++ for
scientific programming... I'm working on a program that needs to resize
a 2d vector of vectors within a function... This variable "tri" is an
input arg to my function using the syntax:
function(vector<vector<int> >& tri)
The problem occurs when the tri 'matrix' is resized to triple or
quadruple the originally allocated size (which I guess requires a
complete reallocation and consequently, a change in the memory address).
Just having to deal with a slew of memory allocation issues, and I
was wondering if there is a good way to resize this 2d vector other than
defining a class to contain the tri variable, and writing a resize
function within the class?
Thanks for your help!
Matt