I have a struct that looks like this:
struct Vertex
{
int state;
int degree;
int *neighbor;
unordered_set<int> neighbors_set;
};
I am allocating a bunch of these structs like this:
vertex = (Vertex *)malloc(v_n * sizeof(Vertex));
but when I try to add an item to the neighbour_set
of a particular vertex like this:
vertex[x].neighbors_set.insert(1);
the program crashes.
Does anyone have an idea how to fix this?