A
Angus
I have a map between an integer value - call it a deviceID and a device
name - call it devicename.
If I use a map I can either use the int or the string as the key. But
which? If I use for example the deviceid as the key, then if I need to find
the deviceID from the devicename then I need to iterate through the whole
map. I am worried about performance of this.
I setup the map at program startup - and it is static. So I wondered about
haveing a map<string,int> and a map<int,string>. But it doesn't seem so
elegant - although maybe most efficient way.
Are there any other way of me achieving my goal of high performance in
lookups both ways?
Angus
name - call it devicename.
If I use a map I can either use the int or the string as the key. But
which? If I use for example the deviceid as the key, then if I need to find
the deviceID from the devicename then I need to iterate through the whole
map. I am worried about performance of this.
I setup the map at program startup - and it is static. So I wondered about
haveing a map<string,int> and a map<int,string>. But it doesn't seem so
elegant - although maybe most efficient way.
Are there any other way of me achieving my goal of high performance in
lookups both ways?
Angus