454,915 Members | 1,280 Online Need help? Post your question and get tips & solutions from a community of 454,915 IT Pros & Developers. It's quick & easy.

# vector<vector<Point3D> >

 P: n/a Hi everyone, Here about what it is. vector > pVector0; pVector0 is a vector of vector of 3D points. pVector0[i] is a vector of 3D points. pVector0[i][j] is a 3D point. I wanted to add a point pt3D to the m vector in pVector0, I have write these two instructions which belong to a C++ program. vector< vector > pVector0; pVector0[m].push_back(pt3D); I have as error message: Segmentation fault (core dumped) Could anyone give me suggestions? Thanks! hannibal Jul 23 '05 #1
6 Replies

 P: n/a ha************@yahoo.fr wrote: Here about what it is. vector > pVector0; pVector0 is a vector of vector of 3D points. pVector0[i] is a vector of 3D points. pVector0[i][j] is a 3D point. I wanted to add a point pt3D to the m vector in pVector0, I have write these two instructions which belong to a C++ program. vector< vector > pVector0; pVector0[m].push_back(pt3D); I have as error message: Segmentation fault (core dumped) Could anyone give me suggestions? What's the size of 'pVector0'? You're trying to access the m-th element of it, do you know if it even exists? V Jul 23 '05 #2

 P: n/a Victor Bazarov wrote: ha************@yahoo.fr wrote: Here about what it is. vector > pVector0; pVector0 is a vector of vector of 3D points. pVector0[i] is a vector of 3D points. pVector0[i][j] is a 3D point. I wanted to add a point pt3D to the m vector in pVector0, I have write these two instructions which belong to a C++ program. vector< vector > pVector0; pVector0[m].push_back(pt3D); I have as error message: Segmentation fault (core dumped) Could anyone give me suggestions? What's the size of 'pVector0'? You're trying to access the m-th element of it, do you know if it even exists? V The size of pVector0 is not known. I wanted to add m empty vectors to the vector and to add the point pt3D to m vector. vector< vector > pVector0; pVector0.insert(pVector0.end(),m); pVector0[m].push_back(pt3D); Jul 23 '05 #3

 P: n/a ha************@yahoo.fr wrote: Victor Bazarov wrote: ha************@yahoo.fr wrote: Here about what it is. vector > pVector0; pVector0 is a vector of vector of 3D points. pVector0[i] is a vector of 3D points. pVector0[i][j] is a 3D point. I wanted to add a point pt3D to the m vector in pVector0, I have write these two instructions which belong to a C++ program. vector< vector > pVector0; pVector0[m].push_back(pt3D); I have as error message: Segmentation fault (core dumped) Could anyone give me suggestions? What's the size of 'pVector0'? You're trying to access the m-th element of it, do you know if it even exists? V The size of pVector0 is not known. REALLY? Have you tried calling pVector0.size()? I wanted to add m empty vectors to the vector and to add the point pt3D to m vector. If you add m vectors to the vector, what's their indices? vector< vector > pVector0; pVector0.insert(pVector0.end(),m); pVector0[m].push_back(pt3D); V Jul 23 '05 #4

 P: n/a ha************@yahoo.fr wrote: Hi everyone, Here about what it is. vector > pVector0; pVector0 is a vector of vector of 3D points. pVector0[i] is a vector of 3D points. pVector0[i][j] is a 3D point. I wanted to add a point pt3D to the m vector in pVector0, Are you sure this 'm' vector exists? I have write these two instructions which belong to a C++ program. vector< vector > pVector0; pVector0[m].push_back(pt3D); If that's the only 2 lines you wrote, there's a problem. The vector is empty and you are trying to access it's mth element. Illegal. If you want to add a point, you first need to add a vector of points. std::vector vector_of_points; vector_of_points.push_back(a_point); pVector0.push_back(vector_of_points); Remember: pVector0 is a vector of vectors of points. Jonathan Jul 23 '05 #5

 P: n/a Victor Bazarov wrote: ha************@yahoo.fr wrote: Victor Bazarov wrote: ha************@yahoo.fr wrote: Here about what it is. vector > pVector0; pVector0 is a vector of vector of 3D points. pVector0[i] is a vector of 3D points. pVector0[i][j] is a 3D point. I wanted to add a point pt3D to the m vector in pVector0, I have write these two instructions which belong to a C++ program. vector< vector > pVector0; pVector0[m].push_back(pt3D); I have as error message: Segmentation fault (core dumped) Could anyone give me suggestions? What's the size of 'pVector0'? You're trying to access the m-th element of it, do you know if it even exists? V The size of pVector0 is not known. REALLY? Have you tried calling pVector0.size()? I have tried calling pVector0.size(), pList0.size() = 0 I wanted to add m empty vectors to the vector and to add the point pt3D to m vector. If you add m vectors to the vector, what's their indices? I added m vectors at the end of the vector. vector< vector > pVector0; pVector0.insert(pVector0.end(),m); pVector0[m].push_back(pt3D); V Jul 23 '05 #6

 P: n/a Jonathan Mcdougall wrote: ha************@yahoo.fr wrote:Hi everyone,Here about what it is.vector > pVector0;pVector0 is a vector of vector of 3D points.pVector0[i] is a vector of 3D points.pVector0[i][j] is a 3D point.I wanted to add a point pt3D to the m vector in pVector0, Are you sure this 'm' vector exists?I havewrite these two instructions which belong to a C++ program.vector< vector > pVector0;pVector0[m].push_back(pt3D); If that's the only 2 lines you wrote, there's a problem. The vector is empty and you are trying to access it's mth element. Illegal. If you want to add a point, you first need to add a vector of points. std::vector vector_of_points; vector_of_points.push_back(a_point); pVector0.push_back(vector_of_points); Remember: pVector0 is a vector of vectors of points. Jonathan Thank you for your guys idea. hannibal Jul 23 '05 #7

### This discussion thread is closed

Replies have been disabled for this discussion. 