
28 May
2014
28 May
'14
9:45 a.m.
I'm studying the implementation of foreach and I had a question about should_copy_impl. For reference, here's the overload that's vexing me: // If the collection is an array or is noncopyable, it must be an lvalue. // If the collection is a lightweight proxy, treat it as an rvalue // BUGBUG what about a noncopyable proxy? template<typename LValue, typename IsProxy> inline BOOST_DEDUCED_TYPENAME boost::enable_if<boost::mpl::or_<LValue, IsProxy>, IsProxy>::type * should_copy_impl(LValue *, IsProxy *, bool *) { return 0; } Why is enable_if needed? Can't the return type just be "IsProxy *"?