My Class
class Grafo{
int numeroVertice;
list<int> *arestas;
public:
Grafo(int vertices);
int addVertice(int quantidade);
void addAresta(int verticeOrigem, int verticeDestino);
void remAresta(int verticeOrigem, int verticeDestino);
void verificaAresta(int verticeOrigem, int verticeDestino);
int grauVertice(int vertice);
void percorreLista(int v);
bool existeLigacao(int origem, int destino);
};
My builder:
Grafo::Grafo(int vertices){
this->numeroVertice = vertices;
arestas = new list<int>[vertices];
}
My problem:
int Grafo::addVertice(int quantidade){
arestas = new list<int>[vertices];
return this->numeroVertice = this->numeroVertice + quantidade;
}
How to make when this addVertice method, increase the amount of allocations to my list 'edges'?
I was thinking of using something like:
it=std::set_union (first, first+5, second, second+5, v.begin());
v.resize(it-v.begin());
But I'm using a pointer there, I lose, anyone willingly there? The final goal is the list that has 5 allocations, could be increased to 10 for example.