地址不是我想要的内容
Not the address I want content?
我只是越来越困惑,浪费更多的时间在我的代码。我只想要迭代器的内容,而不是它的地址。下面是我的代码:
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
}
尝试将代码更改为以下内容:
std::vector<Peptides> p = this->get_PepList();
std::vector<Peptides>::iterator itPep = std::find_if (p.begin(),
p.end(),boost::bind(&Peptides::Peptide_comparison, _1,tempPep));
如果你想要的内容,指向它:*itPep
迭代器重载*
操作符并返回数据。(谢谢你的更正,我不知道!)
相关文章:
- 如何设置一个范围来提取我想要获得的信息
- 链接列表运算符重载没有打印出我想要的内容
- 莱克斯没有返回我想要的东西
- 而不是那么多的 if 语句,我想要一个逻辑,我可以用一个语句或优化的方式来完成
- 我想要一个具有子函数的函数访问相同的命名函数,而不使用它取决于其子类的类
- 如何让m_refcount变量打印出我想要的值而不是垃圾
- 我想要一个改变数组快速排序的2个数字的函数
- 输出不是我想要C++的
- 使用运算符覆盖排序没有得到我想要的
- C ++,否则文本程序不会进入我想要的途径
- 如何声明一个未知大小的数组,然后输入直到我想要,然后获取数组的大小
- 我如何使用 juce 的文件过滤器描述我想要的文件过滤器?
- 如何设置此视觉工作室 (2015) 自定义生成步骤(工具?基本上,我想要一个修改头文件(c ++)的预处理器步骤
- 代码不会发送我想要的权衡
- 无法在openGL和GLUT中为我想要的确切对象设置动画
- 我如何强迫Visual Studio使用我想要的依赖性库名称
- 我的 OpenGL QQuickItem 没有我想要的大小
- 我可以/应该在 #ifndef 后输入任何我想要的东西
- C++ microshell,输入一个命令并使用fork(),dup(),pipe()将其通过管道传输到进程。只是我没有得到我想要的结果
- 地址不是我想要的内容