#include
#include
I am getting an error in the addEdge function.
no matching function for call to 'HexBoard::addEdge(__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, PlayerColor> > >::value_type&, __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, PlayerColor> > >::value_type&)'
The code is
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <ctime>
using namespace std;
enum class PlayerColor {BLACK, BLUE, RED};
class HexBoard
{
private:
int SIZE;
vector< vector<int> > edge;
typedef pair<int, PlayerColor> ip;
vector< vector< ip > > vertices;
public:
HexBoard(int size):SIZE(size)
{
vertices=vector< vector< ip > > (size +1,vector< ip >(size + 1));
auto c=1;
for(auto i=vertices.begin()+1;i<vertices.end();++i)
for(auto j=i->begin()+1;j<i->end();++j)
{
j->first=c++;
j->second=PlayerColor::BLACK;
}
};
void HexBoard::addEdge(int u, int v)
{
edge[u].push_back(v);
edge[v].push_back(u);
}
void HexBoard::func()
{
addEdge(vertices[i][j+1].first,vertices[i][j].first);
}