|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-06-03 21:17:01
Arkadiy Vertleyb wrote:
> "Jonathan Turkanis" wrote
>> Arkadiy Vertleyb wrote:
>>> Given a function type F, and parameter type T, how to create an
>>> expression for typeof to use in the return type? I use VC71, and
>>> the only thing that seems to work (but with a warning) is:
>> I'm not sure if this if what you have in mind, but the following
>> compiles without warning with VC7.1, como and GCC 3.4:
> Actually here is a minimal example of what I meant:
>
> template<int n> struct int_;
>
> template<class F>
> int_<sizeof( (*(F*)0)() )> foo(); // doesn't compile in VC71
It compiles with GCC 3.4.2, como 4.3.3 (strict) and CodeWarrior 9.4. Looks like
ETI.
BTW, you can avoid dereferencing a null pointer by using a helper struct with a
static member.
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk