typeof()
J Arrizza
cppgent0 at gmail.com
Sat Oct 22 18:18:27 PDT 2011
Thanks. I tried typeid vs typeof and as you pointed out the runtime vs
compile time info isn't what I need.
On Thu, Oct 20, 2011 at 6:55 AM, Steven Schveighoffer
<schveiguy at yahoo.com>wrote:
> On Thu, 20 Oct 2011 09:46:09 -0400, J Arrizza <cppgent0 at gmail.com> wrote:
>
> Maybe I'm doing something else incorrectly:
>>
>> [snip]
>
>
>> which still seems to support that typeof() doesn't return the underlying
>> type.
>>
>
> typeid is not typeof. Reread the response below.
>
> However, note that typeid returns a TypeInfo object, which is used at
> runtime, not at compile time. D's runtime type info is very limited, so you
> may not be able to get what you are looking for.
>
> -Steve
>
>
>> On Thu, Oct 20, 2011 at 12:25 AM, Jens Mueller <jens.k.mueller at gmx.de
>> >wrote:
>>
>> J Arrizza wrote:
>>> > typeof returns the type of the object given to it:
>>> >
>>> > SomeClass sc;
>>> > typeof(sc) // returns SomeClass
>>> >
>>> > Object o = sc;
>>> > typeof(o) // returns Object
>>> >
>>> > Is there a way or call to get the underlying type?:
>>> >
>>> > typeof2(o) //returns SomeClass
>>> >
>>> > I checked the online doc, but nothing in the Declarations section that
>>> I
>>> > could see.
>>>
>>> typeid should work.
>>> http://d-programming-language.**org/expression.html#**TypeidExpression<http://d-programming-language.org/expression.html#TypeidExpression>
>>>
>>> Jens
>>>
>>>
>>
>>
--
John
blog: http://arrizza.blogspot.com/
web: http://www.arrizza.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111022/bd39340d/attachment.html>
More information about the Digitalmars-d
mailing list