나는 점점 더 많은 시간을 내 코드에 낭비하여 점점 더 혼란스러워지고있다. 난 그저 이터레이터의 내용이 아니라 그 주소를 원한다. *itPep
이주소가 아님 콘텐츠를 원하십니까?
반복자는 *
연산자를 오버로드 및 데이터를 반환 : 당신이 그것에 내용, 포인트를 원하는 경우
Peptides tempPep;
tempPep.set_PEPTIDE("AABF");
std::vector<Peptides>::iterator itPep = std::find_if (this->get_PepList().begin(), this->get_PepList().end(),boost::bind(&Peptides::Peptide_comparison, _1,tempPep));
if (itPep != this->get_PepList().end())
{
Spectra tempSp;
tempSp.set_Charge(1127);
tempSp.set_Snum(1);
std::cout << "without iterator "<< this->get_PepList()[0].get_New_S_num() << std::endl;
// output -> 0
std::cout << "with iterator" << itPep->get_New_S_num() <<std::endl;
//output -> 1129859637
}
은 무엇'get_PepList()가'사본 또는 참조를 반환합니까? 'itPep'은 호출로부터 반환 된 벡터가 만료되었을 때 아마도 매달려 있습니다. –
C++ 유형은 가장 중요합니다. 'Peptides' 란 무엇이고'this'의 타입은 무엇이고'get_PepList()'와'get_New_S_num()'은 어떻게 작동합니까? –