简体   繁体   English

没有匹配&#39;(std :: vector <foo> )(std :: vector <foo> :: iterator&)&#39;

[英]no match for call to ‘(std::vector<foo>) (std::vector<foo>::iterator&)’

I've got a class foo, and have created a vector for it using this code 我有一个foo类,并使用此代码为其创建了一个向量

std::vector<foo> fooVector;

I also have an iterator using this code 我也有一个使用此代码的迭代器

std::vector<foo>::iterator locator;

now I'm getting this error 现在我得到这个错误

foo.cpp:29:25: error: no match for call to ‘(std::vector<foo>) (std::vector<foo>::iterator&)’

and the corresponding line is 相应的行是

if(fooVector(locator).getBoo() + (insertBar.geBoo()) < 4000)

as far as I can tell I'm using the iterator correctly? 据我所知,我正确使用了迭代器?

I'm not sure what is wrong with how I'm using it? 我不确定我的使用方式有什么问题?

fooVector(locator) what do you want to express by this? fooVector(locator)您要表达什么?

fooVector is a variable not a function. fooVector是变量而不是函数。

如果在使用locator器迭代器之前正确对其进行了初始化,则应将代码更改为

if(locator->getBoo() + (insertBar.geBoo()) < 4000)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM