Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-06-09 14:02:16


"Arkadiy Vertleyb" <vertleyb_at_[hidden]> writes:

> "Doug Gregor" <dgregor_at_[hidden]> wrote
>
>> On Jun 9, 2005, at 12:53 PM, Arkadiy Vertleyb wrote:
>>
>> > "David Abrahams" <dave_at_[hidden]> wrote
>> >
>> >> template <class F, class A>
>> >> struct result_of<F(A)>
>> >> {
>> >> typedef typename BOOST_TYPEOF(make<F>() ( make<A>() ) ) type;
>> >> };
>> >
>> > BTW, I was having (not typeof-related) problems trying to achieve this
>> > kind
>> > of syntax in VC7.1 :-(
>> >
>> > http://lists.boost.org/boost/2005/06/27892.php
>> >
>> > "make<F>()(make<A>())" just doesn't work. The only thing that kind of
>> > works
>> > (but with a warning) is "F()(make<A>())".
>> >
>> > Am I missing something?
>>
>> Should that be "make<F&>"? For workarounds, we could also declare a
>> static member of type F.
>
> The following doesn't compile in VC7.1:
>
> template<int n> struct int_;
> template<class T> T make();
>
> template<class F>
> int_<sizeof( (make<F&>())() )> foo();
>
> int main()
> {
> }

Try:

template<int n> struct int_;
template<class T> struct made { static T value; };

template<class F>
int_<sizeof( made<F&>::value () )> foo();

int main()
{
}

-- 
Dave Abrahams
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