ich zu lernen versuche wie std::map
funktioniert, ich folgendes Problem:einen int zu einer Struktur von Vektoren in C Mapping ++
int id; // stores some id
struct stuff {
std::vector<int> As;
std::vector<int> Bs;
} stuff;
std::map<int, stuff> smap;
void foo() {
int count = 2;
int foo_id = 43;
for (int i = 0; i < count; count++) {
stuff.As.push_back(count);
stuff.Bs.push_back(count);
}
smap.insert(foo_id, stuff);
}
Derzeit erhalte ich:
error: type/value mismatch at argument 2 in template parameter list for ‘template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map’
std::map<int, stuff> smap;
error: request for member ‘insert’ in ‘smap’, which is of non-class type ‘int’
smap.insert(int, stuff);
ich sein will fähig, die id
zu der struct
abzubilden, die aus zwei Vektoren besteht, die in einer for-Schleife bevölkert werden. Was mache ich falsch? Oder gibt es einen besseren Weg dies zu kartieren?
Führen Sie eine der 2 'stuff' – JVApen