Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-03-17 05:30:36


Ian McCulloch wrote:
> Thanks Peter, I think I understand how it works now. Unfortunately,
> the 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.

Yes, I've encountered this too. The problem is in the unconditional
instantiation of the nested ::result<>. Since we don't have a reliable way
to detect a nested template yet (requires core language change), this can't
be fixed except by removing the ::result<> logic altogether and relying on
specializations instead, as in the example I gave.

This won't help us in general, though. result_of is not supposed to support
SFINAE, because it may be implemented with __typeof or __decltype
internally.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net