i have a pointer to a vector of pointers to objects and i want to call a method on each of those objects.
oc->features is defined as:
vector<Feature*>* features;
i have to do:
Expand|Select|Wrap|Line Numbers
- vector<Feature*>::iterator it;
- for (it=oc->features->begin();it!=oc->features->end();it++){
- Feature* a=*(it);
- int score=a->scoreFeature(view);
- }
Expand|Select|Wrap|Line Numbers
- int score=*(it)->scoreFeature(view);
ViewEvaluator.cpp:48: error: request for member ‘scoreFeature’ in ‘* it.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator-> [with _Iterator = Feature**, _Container = std::vector<Feature*, std::allocator<Feature*> >]()’, which is of non-class type ‘Feature*’
//make[2]: *** [CMakeFiles/testOVAS.dir/ViewEvaluator.cpp.o] Error 1
//make[1]: *** [CMakeFiles/testOVAS.dir/all] Error 2
non-class type Feature* ?? i dont get it...
can anyone shed light on what might be happening here?
incidentally i thought it could be something to do with having a pointer to a container and using an itterator on it (at first i tried dereferencing that didnt work). I then realised that i have another example in my code using a pointer to vector and the analogous code works.