M
Mike Copeland
I am trying to create a "find_if" that will allow me to find a
std::map object via a secondary field. That is, I need to search using
the "entName" field in the defined structure, even though the objects
are stored via the "bibNum" (integer) field. I have tried to find the
information in Google, but the conversion from what I find there to my
specific problem eludes me: I cannot compile the code below.
typedef struct ChipRecord // Chip Times record
{
int bibNum; // Bib #
short entAge; // Age
char entGender; // Gender (M/F)
char entRCode; // RCode
char entECode; // Entrant Type code
string entName; // Entrant Name
} tData; // entrant info records
tData tWork;
tData qWork;
typedef map<int, ChipRecord> BCI;
BCI bci;
map<int, ChipRecord>::iterator bIter;
class NameMatch
{
string m_name;
public:
NameMatch(string &name) : m_name(name) {}
bool operator()(const pair<unsigned int, BCI> &o)
{
return (m_name == o.second.);
}
};
Furthermore, I don't know how I'd actually implement a "find_if" with
the defined structures and object...so I'd like some help there, as
well. TIA
std::map object via a secondary field. That is, I need to search using
the "entName" field in the defined structure, even though the objects
are stored via the "bibNum" (integer) field. I have tried to find the
information in Google, but the conversion from what I find there to my
specific problem eludes me: I cannot compile the code below.
typedef struct ChipRecord // Chip Times record
{
int bibNum; // Bib #
short entAge; // Age
char entGender; // Gender (M/F)
char entRCode; // RCode
char entECode; // Entrant Type code
string entName; // Entrant Name
} tData; // entrant info records
tData tWork;
tData qWork;
typedef map<int, ChipRecord> BCI;
BCI bci;
map<int, ChipRecord>::iterator bIter;
class NameMatch
{
string m_name;
public:
NameMatch(string &name) : m_name(name) {}
bool operator()(const pair<unsigned int, BCI> &o)
{
return (m_name == o.second.);
}
};
Furthermore, I don't know how I'd actually implement a "find_if" with
the defined structures and object...so I'd like some help there, as
well. TIA