From -4288703031286384049
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ede379f5dbbc1549
X-Google-Attributes: gidf78e5,public
From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Suggestion: "typeof" keyword
Date: 1999/08/16
Message-ID: <7p8h3g$ftv$1@mulga.cs.mu.OZ.AU>#1/1
X-Deja-AN: 513421647
X-Nntp-Posting-Host: murlibobo.cs.mu.oz.au
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <7nt3vl$1oe$1@nnrp1.deja.com> <7oh7o8$t3f$1@nnrp1.deja.com> <7ol6hi$ej9$2@news.BelWue.DE> <cTiioXAhAwr3Ew$X@robinton.demon.co.uk> <t7d7ww1vrz.fsf@calumny.jyacc.com> <e4DSyfA4ALs3Ew0Q@robinton.demon.co.uk> <t7hfm6ytow.fsf@calumny.jyacc.com> <37B2DA79.3A02@wanadoo.fr> <7p0lub$2i3$1@mulga.cs.mu.OZ.AU> <t7pv0r4p8h.fsf@calumny.jyacc.com>
Organization: Computer Science, The University of Melbourne
X-UID: 0000000001
X-Status: $$$T
Newsgroups: comp.std.c++
Originator: clamage@taumet


Hyman Rosen <hymie@prolifics.com> writes:

 >fjh@cs.mu.OZ.AU (Fergus Henderson) writes:
 >> However, `typeof' is not quite as general as argument type deduction.
 >> For example, you may know that a particular variable has type
 >> `foo<const T *>', and you may want to find out what `T' is;
 >> you can do that with argument type deduction, but you can't do it
 >> with `typeof'.
 >
 >Sure you can:
 >
 >template < typename T > struct foo;
 >template < typename U > void call_with_foo(U my_foo_var)
 >{
 >	// I know that my_foo_var is really a foo < const T * >
 >	struct deduce
 >	{
 >		template < typename T > T operator()(foo < const T *>);
 >	};
 >	typedef typeof(deduce()(my_foo_var)) my_T;
 >}

Here the deduction is being done by the argument type deduction for
the `deduce<T>::operator()' function, rather than by `typeof()'.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




