I don’t understand what this snippet is do, if anyone could explain it would help out a great deal.
bool result;
for (std::set<_Tp>::const_iterator o = objs.begin(); o != objs.end(); o++)
{
//confusion here, what does this do
result |= accept(c, *o, bid); //accept returns a bool
}
return result;
}
I know that the |= compound operator does a bitwise OR but what does that mean for the value of result? If accept returns true then the value of result will stay true, right?
I guess I don’t really understand why the |= is there instead of =
Any help would be great
Thanks
|=is a bitwise or, not a logical or. You have removed the logic out of the snippet, but basically what it does is return true as long as any object within the set is ‘accepted’, whatever the definition ofacceptis.