
6 Jul
2007
6 Jul
'07
4:05 p.m.
Lewis Hyatt skrev:
Anyway, I guess this isn't such a big issue, because if copying a container is too expensive, you probably shouldn't be returning it from functions anyway...
On the contrary, copying can be essentially free because of the Return Value Optimization (RVO). Eric, maybe there should be an extra macro: BOOST_RVALUE_FOREACH( const T& x, get_rvalue_container() ) which does not make the copy? At the call site, you usually know which macro to apply. -Thorsten