
Arkadiy Vertleyb wrote:
"Ian McCulloch" <ianmcc@physik.rwth-aachen.de> wrote
lack of SFINAE is a real showstopper for me. I want to write functions like
template <typename T> typename result_of<negate(T)>::type operator-(T const& x) { return negate()(x); }
but the lack of SFINAE here makes boost::result_of essentially useless for this. But I imagine it won't be difficult to make a new version based on boost that would work.
FWIW:
template<class T> T make();
template <class T> BOOST_TYPEOF_TPL(make<std::negate<T> >()(T())) operator-(T const& x) { return std::negate<T>()(x); }
This looks very attractive, and I'll probably und up using it somewhere; but in the particular application I'm working on, something like result_of (but allows SFINAE) will do fine. I guess its just a matter of what changes I'll need to make when we get decltype. With the result_of approach I could get rid of the nested result<> structs and/or result_of specializations, with the BOOST_TYPEOF approach I could simplify the forwarding function declarations. I'm not sure what is the better tradeoff. Cheers, Ian