Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-06-03 19:46:37

Arkadiy Vertleyb wrote:

> I was trying to come up with a useful example of LVALUE_TYPEOF, so I
> decided to implement the "trace" function from the motivation section
> of decltype/auto proposal. However I ran into unexpected problem:
> 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:
> F()(T())

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:

    struct F {
        template<typename T>
        int operator()(T t) { return 0; }

    int main()
        (void) sizeof( (*(F*)0)( *(int*)0 ) );


Boost list run by bdawes at, gregod at, cpdaniel at, john at