recently I’ve been reading through Scott Meyers’s excellent Effective C++ book. In one of the last tips he covered some of the features from TR1 – I knew many of them via Boost.
However, there was one that I definitely did NOT recognize: tr1::reference_wrapper.
How and when would I use tr1::reference_wrapper?
It’s like boost::ref, as far as I know. Basically, a reference which can be copied. Very useful when binding to functions where you need to pass parameters by reference.
For example (using boost syntax):
This Dr. Dobbs article has some info.
Hope this is right, and helpful. 🙂