Re: RTTI typeinfo pointers
From: tom_usenet (tom_usenet_at_hotmail.com)
Date: 06/01/04
- Next message: Steven T. Hatton: "Re: What do other's make of this code?"
- Previous message: Pete Becker: "Re: function template"
- In reply to: Asfand Yar Qazi: "RTTI typeinfo pointers"
- Next in thread: Asfand Yar Qazi: "Re: RTTI typeinfo pointers"
- Reply: Asfand Yar Qazi: "Re: RTTI typeinfo pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 01 Jun 2004 17:24:19 +0100
On Tue, 01 Jun 2004 16:35:11 +0100, Asfand Yar Qazi
<im_not_giving_it_here@i_hate_spam.com> wrote:
>Hi,
>
>Will the std::type_info object returned by typeid be the same
>object every time it is called for a given type?
No (specifically on Windows with a type defined both in a .exe and a
.dll), and the standard doesn't require it. The objects must compare
equal though, of course.
>
>Can there ever be a chance that a std::type_info object returned
>by typeid for two different types will share the same memory
>address?
No, it wouldn't be conforming.
> Lets say, for example, I want to use the address of the
>type_info object as a hash value.
type_info objects work well in a sorted container, due to their
"before" member function. But hashing by pointer value should be
reliable on some platforms at least, just not guaranteed to work by
the standard, and it probably won't work on Windows.
Tom
-- C++ FAQ: http://www.parashift.com/c++-faq-lite/ C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
- Next message: Steven T. Hatton: "Re: What do other's make of this code?"
- Previous message: Pete Becker: "Re: function template"
- In reply to: Asfand Yar Qazi: "RTTI typeinfo pointers"
- Next in thread: Asfand Yar Qazi: "Re: RTTI typeinfo pointers"
- Reply: Asfand Yar Qazi: "Re: RTTI typeinfo pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|