I wabt to have multiple data value component types in a std::map key.
The code below doesn't compile. My intent is to use a std::map key
of a struct type, so I could access the key's component data values
without deconstructing a scalar data type value. The "key" is made up
of 2 parts (a numeric year and a numeric value).
If I construct a std::string value of these components and use that
data type the compiler accepts it.
It won't allow a "struct" data type for a key value.
Is there a way to do this? TIA
[e.g.]
struct LinkKeyType
{
short nYear;
int nBib;
} linkKey;
struct linkStruct
{
char entCode;
int nAge;
std::string nameStr;
} link;
std::map<LinkKeyType, linkStruct> bibMap;
std::map<LinkKeyType, linkStruct>::iterator lIter;
...
link.entCode = 'M', link.nAge = 45;
link.nameStr = "George Washington";
linkKey.nBib = 123, linkKey.nYear = 88;
bibMap[linkKey] = link;
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus