Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-10-30 23:24:28


Eric Niebler wrote:
> Eric Niebler wrote:
>> Richard Crossley wrote:
>> >
>> > http://article.gmane.org/gmane.comp.lib.boost.user/14256
>> >
>> > I ended up giving up with result_of assuming I must be misunderstanding
>> > something as I never got any response.
>> >
>>
>> It appears to be the same issue. I added your much simpler test case to
>> the bug report. Thanks. Sadly, giving up on result_of is not really an
>> option -- it's standard, now. I hope we can find a work-around.
>
>
> Ah-ha! I've found a work-around for this problem. If you have code like
> this:
>
> template<typename T>
> struct Foo
> {
> template<typename Sig> struct result;
> template<typename This, typename A>
> struct result<This(A)>
> {
> typedef A type;
> };
> ...
> }

<snip>

Another work-around is to add the following:

#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
namespace boost
{
   template<typename T>
   struct result_of;

   template<typename T, typename A>
   struct result_of<Foo<T>(A)>
     : Foo<T>::template result<void(A)>
   {};
}
#endif

This works without forcing you to add a bogus base class, which is handy
if you want Foo<T> to be POD.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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