Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-07-03 10:50:21


Douglas Gregor wrote:
> You want the mythical 'typeof' operator :). AFAIK, this is
> not possible in C++ without an externsion. Some compilers
> (GCC and Metrowerks, possibly others) have a "typeof"
> extension where you would change the typedef above to:
>
> typedef typeof(RetT() * ArgT()) RetTimesArgT;
>
> (ideally it would not require default-construction, but I
> don't want to clutter the example).
>
> Libraries deal with this usually by defining trait classes
> that give the result types of operations used by the library.
> Other libraries try to emulate typeof itself using a type
> registration system of some sort (there is one in the files
> section that does this).

..and there is another one that takes the first approach :), see
http://groups.yahoo.com/group/boost/files/types_promotion_traits/
and also http://groups.yahoo.com/group/boost/message/7182 thread.

Aleksey


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