Re: typeid operator
From: Jonathan Turkanis (technews_at_kangaroologic.com)
Date: 10/27/04
- Next message: Ioannis Vranos: "Re: Polymorphism"
- Previous message: Rob Williscroft: "Re: weird error"
- In reply to: Victor Bazarov: "Re: typeid operator"
- Next in thread: Tom Widmer: "Re: typeid operator"
- Reply: Tom Widmer: "Re: typeid operator"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 27 Oct 2004 13:55:18 -0600
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in message
news:0LSfd.7263$Ae.1053@newsread1.dllstx09.us.to.verio.net...
> Andrew Koenig wrote:
> > "Marco Jez" <nessuno@nessuno.com> wrote in message
> > news:FORfd.214470$35.10108467@news4.tin.it...
> >
> >
> >>I would like to use the reference returned by typeid as key in a std::map.
> >>Is it safe to assume that typeid(T) (where T is a type name) will always
> >>return the same reference to the same type_info structure for a given T?
> >
> >
> > I don't see why you should be able to make that assumption.
>
> I think the Standard in 5.2.8 says that the lvalue is returned and that
> the lifetime of the object referred to by the lvalue is entire program.
> So, why should we be able to make that assumption? Or did you forget the
> 'not' as in "I don't see why you should _not_ be able..."?
Wouldn't it be legal -- but insane -- for an implementation to have several
type_info objects for a given type, each of which has lifetime equal to the
entire program, and for typeid to to select one at random each time typeid is
invoked?
Perhaps support for dynamic libraries might sometimes lead to the existence of
two typeid objects for the same type.
Jonathan
- Next message: Ioannis Vranos: "Re: Polymorphism"
- Previous message: Rob Williscroft: "Re: weird error"
- In reply to: Victor Bazarov: "Re: typeid operator"
- Next in thread: Tom Widmer: "Re: typeid operator"
- Reply: Tom Widmer: "Re: typeid operator"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|