P
peter_k
#include <cstdlib>
#include <iostream>
#include <hash_map.h>
using namespace std;
typedef struct {
unsigned long data[3];
} sKey, tKey;
typedef struct {
unsigned char value;
} sValue, tValue;
namespace __gnu_cxx {
template<>
struct hash<tKey> {
size_t operator()(const tKey &d) const {
return d.data[0];
};
};
};
int main(int argc, char *argv[])
{
hash_map<tKey, tValue, hash<tKey> > dane;
tKey key;
tValue value;
key.data[0] = 13;
key.data[1] = 0;
key.data[2] = 0;
value.value = 15;
dane[key] = value; // here something is wrong
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
#include <hash_map.h>
using namespace std;
typedef struct {
unsigned long data[3];
} sKey, tKey;
typedef struct {
unsigned char value;
} sValue, tValue;
namespace __gnu_cxx {
template<>
struct hash<tKey> {
size_t operator()(const tKey &d) const {
return d.data[0];
};
};
};
int main(int argc, char *argv[])
{
hash_map<tKey, tValue, hash<tKey> > dane;
tKey key;
tValue value;
key.data[0] = 13;
key.data[1] = 0;
key.data[2] = 0;
value.value = 15;
dane[key] = value; // here something is wrong
system("PAUSE");
return EXIT_SUCCESS;
}