I'm new to C ++ (I learned programming with Fortran), and I would like to allocate dynamic memory for a multi-dimensional table. This table is a private member variable:
class theclass {public: zero set (zero); Private: std :: vector & lt; Std :: vector & lt; Int & gt; & Gt; Table; } I would like to set the dimensions of thetable with function setdim ().
theclass :: setdim (zero) {this-> gt; Thalesbell.Signet (1000, study :: Vector and lieutenant; At & G; (2000)); } I have no problem compiling this program, but as I execute it, I have a partition error.
The strange thing for me is that the code under this piece (see) does exactly what I do, except that it does not use the private member variable of my class:
std :: vector & lt; Std :: vector & lt; Int & gt; & Gt; Table; Thetable.assign (1000, std :: vector & lt; int & gt; (2000)); By the way, if there is a handbag 1D vector then I have no problem. In class:
stud :: vector & lt; Int & gt; Table; and if setdim is in:
it-> Thairebill. Signature (1000,2); So my question is: why is it possible for 2D vector and this- & gt; Is there a difference between "Assign"?
Text ">
Since it works with a local and with my class variable my mental debugging powers tell me that you have a blank or invalid pointer / example of setdim theclass On
Comments
Post a Comment