Consider the following code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Vertex {
public:
int id;
vector<Vertex*> edges;
Vertex(int id) : id(id) {}
int get_id() const {return id;}
};
class Graph {
public:
vector<Vertex*> vertices;
Graph(int V) {
vertices.reserve(V);
}
void test(vector<Vertex*>& other) {
sort(vertices.begin(), vertices.end(), [](const Vertex*& one, const Vertex*& two) {return &*one < &*two;});
sort(other.begin(), other.end(), [](const Vertex*& one, const Vertex*& two) {return &*one < &*two;});
}
};
When I try to compile the above I get the error: error: no matching function for call to object of type '(lambda at Graph.cpp:59:48)' if (__comp(*--__last, *__first)). I don't understand how I can fix this issue.
Vertexobjects.