Chyba zaczynam się robić leniwy (Zmęczony extends Leniwy
, Leniwy implements Stary
), umieszczając problem na forum, zamiast samemu go poszukać. :(
Ale do rzeczy.
Wyskakuje mi taki błąd:
Graph.cpp:31:14: error: conversion from '__gnu_cxx::__normal_iterator<const meh_projekt_2::Vertex*, std::vector<meh_projekt_2::Vertex> >' to non-scalar type 'std::vector<meh_projekt_2::Vertex>::iterator {aka __gnu_cxx::__normal_iterator<meh_projekt_2::Vertex*, std::vector<meh_projekt_2::Vertex> >}' requested
Oto kawałek mojego kodu, w którym on występuje (btw. występuje w kilku podobnych metodach):
const Vertex & Graph::getVertex(int vertexNumber) const {
vector<Vertex>::iterator it = find(this->g.begin(),
this->g.end(),
[vertexNumber](const Vertex & v) {
return v.getNumber() == vertexNumber;
}); // W TEJ LINIJCE JEST BŁĄD
...
}
Pole Graph::g
:
private:
vector<Vertex> g;
Metoda getNumber()
:
inline int Vertex::getNumber() const {
return this->number;
}
Jak coś jeszcze będzie potrzebne, oczywiście wkleję.