O
O.B.
In the test program below, the compiler complains that it cannot deduce the
argument when assigning an int value to an entry in a std::map. What am I doing
wrong?
#include <map>
class EntityID {
public:
unsigned int site;
unsigned int application;
unsigned int entity;
};
void main() {
std::map<EntityID,int> test;
EntityID id1;
id1.site = 6;
id1.application = 5;
id1.entity = 4;
test[id1] = 5;
EntityID id2;
id2.site = 6;
id2.application = 5;
id2.entity = 4;
std::map<EntityID,int>::const_iterator i = test.find(id2);
if ( i != test.end() ) {
printf("Test passed.\n");
} else {
printf("Test failed.\n");
}
}
argument when assigning an int value to an entry in a std::map. What am I doing
wrong?
#include <map>
class EntityID {
public:
unsigned int site;
unsigned int application;
unsigned int entity;
};
void main() {
std::map<EntityID,int> test;
EntityID id1;
id1.site = 6;
id1.application = 5;
id1.entity = 4;
test[id1] = 5;
EntityID id2;
id2.site = 6;
id2.application = 5;
id2.entity = 4;
std::map<EntityID,int>::const_iterator i = test.find(id2);
if ( i != test.end() ) {
printf("Test passed.\n");
} else {
printf("Test failed.\n");
}
}