I am new to using boost::bimap
so forgive me if this sounds like a basic question. I am using boost 1.75.0.
Take this snippet of code:
if (rBiMapStudentItemDescBefore.right.count(aryStrStudentItemDesc[i]) > 0)
{
auto it = rBiMapStudentItemDescBefore.right.find(aryStrStudentItemDesc[i]);
CString strNewStudentItemDesc = rBiMapStudentItemDescAfter.left.find(it->second)->second;
pEntry->SetStudentAssignmentType(static_cast<StudentAssign>(i), strNewStudentItemDesc);
}
It works fine. It is not clear to me from the documentation or the examples that I have found if it is possible to do away with the right.count
call and simply test the return value of it
like this:
if (it)
{
}
It does not like it. How do I test if the result from right.find
was found or not? Sorry if I have missed this in the documentation.
I still can't find actual documentation but I think I have it:
auto it = rBiMapStudentItemDescBefore.right.find(aryStrStudentItemDesc[i]);
if (it != rBiMapStudentItemDescBefore.right.end())
{
CString strNewStudentItemDesc = rBiMapStudentItemDescAfter.left.find(it->second)->second;
pEntry->SetStudentAssignmentType(static_cast<StudentAssign>(i), strNewStudentItemDesc);
}