I currently have
std::map<const guid, CommWrapper >* comm_table;
where guid
struct guid
{
unsigned char d[16];
// Less-comparer for std::map with GUID keys
bool operator<(const guid& rhs) const
{
for(unsigned c = 0; 16 != c; ++c)
{
if(d[c] == rhs.d[c]) {
continue;
}
return d[c] < rhs.d[c];
}
return false;
}
};
But it seems to be way slower than the approach i took before, where i just based the (gu)id on the index the pointer had in a std::vector.
for instance truck would be in comm_table[5], and thus its id would be 5.
But I kinda like the idea of using some big, fancy guids. It's just really slow for autonomous inter-instance communication,
and I'm wondering if I'm doing it right. Perhaps there's no reason to go this way at all.
Or am i just using a wrong collection?