Because that would have took more effort to think of than I had cared to put into it.
@DTSCode
I think he means, if you can check to see it the value is true, you should be able to just say if(member_of_cplusplus.present){}else{} because if present is false then it would fail and run the else code block.
1 2 3 4 5 6 7 8
if(true)
{
// run if condition is true
}
else
{
// run if condition is false
}
Doing a while loop would make it a little of a pain as you would have to enter and exit it per member. If a member isn't present the while loop would exit, but could be only an element or two into the member list, a while loop wouldn't be the right choice in this example.
You could put the if/else block in a while loop. Using your method of a while loop would only test up until it ran into a member that wasn't here. For example, if Albatross, Disch, and you were the first three in the list and Albatross didn't bring a present it would evaluate to false and not bother reading Disch or you. So you would have to make a vector to hold the list of members. Then just an example (not actual code).