[ onako @ 26.04.2010. 17:55 ] @
| Take a look at the following code:
Code:
typedef std::vector<unsigned int> VecUnsRAM;
VecUnsRAM myPos(vertices.size());
unsigned int count=0;
for(unsigned int j=0; j<vertices.size();++j) {
myP t=std::make_pair(count, vertices[j].D);
std::cout<<"Got here"<<std::endl;
PQ[j]=t;
std::cout<<"Got here"<<std::endl;
myPos[j]=count;// or myPos[j]=j; produces Seg fault error
std::cout<<"Got here"<<std::endl;
++count;
}
The output is "Got here" twice, and then the Seg fault. Any ideas why this happens?
Thanks |
[ kiklop74 @ 26.04.2010. 22:54 ] @
You can not send incomplete piece of code and expect any kind of answer. When asking a question try to create minimal COMPLETE program, that reproduces the error and send that code here. Than you can expect reasonable answer.
with this code I can only say this:
What type is used for vertices?
What is PQ?
What exactly are you trying to do with this code?
[ Wajda.W @ 28.04.2010. 17:44 ] @
[ kiklop74 @ 28.04.2010. 21:40 ] @
Ma ovaj tip je za ignorisanje, ima autistican pristup komunikaciji.
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.