EDIT 4: Ok, I narrowed the problem down to a small cpp file giving the same error message which everyone can reproduce:
#include<vector>
#include<map>
using namespace std;
namespace{enum class Colors{Black,White};}
class dummyClass{};
class MapTest
{
vector<dummyClass*> Dummys;
map<Colors,vector<dummyClass*>> dummyMap;
public:
MapTest()
{
Dummys.push_back(new dummyClass);
Dummys.push_back(new dummyClass);
dummyMap.insert(make_pair(Colors::White,Dummys));
}
~MapTest()
{
for(unsigned int i=0;i<Dummys.size();++i)
{
delete Dummys[i];
}
Dummys.clear();
dummyMap.clear();
}
};
int main()
{
MapTest m;
}
EDIT 3: In case anyone wonders. I delete all Pointers in the destructor. Didn't post it since I figured it's not relevant to the problem
EDIT 2: Added more details in the .cpp file. The classes "Bauer" and "Position" shouldn't be of any relevance.
My header file match.h:
#include <map>
#include"Bauer.h"
class Match
{
int counter{0};
std::vector<Figuren*> allFiguresWhite;
std::vector<Figuren*> allFiguresBlack;
std::map<Farben,std::vector<Figuren*>> samePlayerFig;
std::map<Farben,std::vector<Figuren*>> otherPlayerFig;
//more code...
}
"Farben" is just a enum : enum class Farben{black, white};
In my match.cpp I try at one point to insert a par into the map:
#include "match.h"
using namespace std;
Match::Match()
{
cout<<"Let the games begin\n";
InitGame();
}
void Match::InitGame()
{
for(int i=1;i<9;i++)
{
allFiguresWhite.push_back(new Bauer(Position{2,i},Farben::white, counter++));
allFiguresBlack.push_back(new Bauer(Position{7,i},Farben::black,counter++));
}
samePlayerFig.insert(make_pair(Farben::white,allFiguresWhite));
//more code...
}
Unfortunately I get the compiler error "Invalid arguments' " in this line with "insert" beeing underlined in red. Any idea what I did wrong?
EDIT: Here is the complete error message
Invalid arguments ' Candidates are: std::pair>>>,bool> insert(const std::pair>> &) std::pair>>>,bool> insert(#10000 &&) void insert(std::initializer_list>>>) std::_Rb_tree_iterator>>> insert(std::_Rb_tree_const_iterator>>>, const std::pair>> &) std::_Rb_tree_iterator>>> insert(std::_Rb_tree_const_iterator>>>, #10000 &&) void insert(#10000, #10000) ' match.cpp /chessGame line 17 Semantic Error
Ok, It seems to be a Eclipse specific error. I compiled the Test programm from the command line using "g++ main.cpp -o main" and it works fine. Gonna look into it why it doesn't work on eclipse. So far I've compiled a lot of projects and never had any compiler issues.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.