I have an error in the code, precisely in the constructor, the compiler says that I am not passing the appropriate parameters, to put in context, this is the class that the constructor has, I only put the relevant functions to understand the doubt :
class Nodo {
private:
point punto_;
float coste_;
Nodo* nodopadre_;
public:
Nodo();
Nodo(point& a, float coste,Nodo *nodopadre);
This is the cpp
Nodo::Nodo(point& a, float& coste,Nodo *nodopadre):
punto_(a),
coste_(coste),
nodopadre_(nodopadre){}
Where the compiler error occurs, this is in another class:
if((map.get(c_a,++c_b))!=1){
point p(c_a,++c_b);
float costtan=0;
list<Nodo>::iterator it1 = inspectioned_nodes_.end();
it1--;
Nodo np(*it1);
Nodo ns(p,costtan,np); //ERROR
costtan= g_n(ns)+ heuristica1(ns); //nodos adyacentes, distancia=1
ns.set_coste(costtan);
generated_nodes_.push(ns);
}
The error that comes to me:
error: no matching function for call to ‘Nodo::Nodo(point&, float&, Nodo&)’
Nodo ns(p,costtan,np);
Maybe it's because I need to overload the operator =
in class Nodo
?, although I have a copy constructor in that class.
inspectioned_nodes_
is a list of objects Nodo
Help is appreciated. Thanks