Reputation: 1678
I converted
for(std::set<shape::Face>::iterator face_iter=vec_face.begin(); face_iter!=vec_face.end(); face_iter++)
{
hiddenCorner(other, bmap, *face_iter);
}
into
for_each(vec_face.begin(), vec_face.end(), boost::bind(hiddenCorner, other, bmap, _1));
Obviously it is less verbose, but how about efficiency?
hiddenCorner is a void function which update bmap (bmap is a std::map).
NOTE: vec_face is not a really big size set.
Upvotes: 0
Views: 55
Reputation: 171263
hiddenCorner is a void function which update bmap (bmap is a std::map).
The bind
version makes copies of other
and bmap
which are stored in the binder, then passes them to the function, so the function updates the copy in the binder, not bmap
itself.
So apparently not only have you not tried to measure performance yourself, you haven't even tested to see if it works. No cookie for you.
If you write it properly, using boost::ref
, it should be roughly equivalent performance, assuming you turn on optimisation.
Upvotes: 5