Date: Mon, 08 Apr 2024 08:52:18 -0500
On Monday 8 April 2024 03:06:02 CDT Frederick Virchanza Gotham via Std-
Proposals wrote:
> I argued a day or two ago here on this mailing list that it should
> have simply been a standard library function, i.e. "std::typeid",
> instead of an operator.
It had to be an operator back in the days of pre-standardisation in order to
create the typeinfo objects for both polymorphic and non-polymorphic types.
For polymorphic types, they need to be in the class's vtable, so it needs to
be a type whose name the compiler knows, because *it* will instantiate it. So
it can't be a standard library function.
Besides, unless you have a time machine, we can't revisit this 30-year-old
decision. So why discuss it? Is there a problem with it today?
Proposals wrote:
> I argued a day or two ago here on this mailing list that it should
> have simply been a standard library function, i.e. "std::typeid",
> instead of an operator.
It had to be an operator back in the days of pre-standardisation in order to
create the typeinfo objects for both polymorphic and non-polymorphic types.
For polymorphic types, they need to be in the class's vtable, so it needs to
be a type whose name the compiler knows, because *it* will instantiate it. So
it can't be a standard library function.
Besides, unless you have a time machine, we can't revisit this 30-year-old
decision. So why discuss it? Is there a problem with it today?
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Cloud Engineering
Received on 2024-04-08 13:52:21