Boost logo

Boost :

Subject: [boost] [foreach] Can should_copy_impl return type be simplified?
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2014-05-28 05:45:46


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 *"?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk