|
|
|
|
|
by femngi
4230 days ago
|
|
Since it is a template you could always use universal references to avoid copying where not needed: template <typename Collection,typename unop>
void for_each(Collection&& col, unop op){
std::for_each(col.begin(),col.end(),op);
}
I'm happy to see more people reading Bartosz, I find his blog very interesting. One point to emphasise about that particular post is that the proposed range library he discusses is already available today, and has been for some time, in the much overlooked boost.Range library. |
|