C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Extend std::type_info with more information

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Thu, 11 Apr 2024 13:39:58 +0000

> All I'm saying is that asking for `any` to support taking out an instance of a base class instead of the actual class stored in it is not unreasonable.

Yes, adding an extra feature to std::any is not unreasonable. And dynamic_cast is not the only form of RTTI in the standard, exceptions requires the ability to do it without a vtable, traversing some form of type_info information must already exist to be able to support that, it just so happens to be implementation specific.

The problem is the OP is not about changing std::any, but adding sizeof and alignof to std::type_info, which doesn’t help at all to solve any existing issue, including with std::any.



From: Std-Proposals <std-proposals-bounces_at_[hidden]> On Behalf Of Mihail Mihaylov via Std-Proposals
Sent: Thursday, April 11, 2024 15:32
To: std-proposals_at_[hidden]cpp.org
Cc: Mihail Mihaylov <mihail.mihailov_at_[hidden]m>
Subject: Re: [std-proposals] Extend std::type_info with more information

On Thu, Apr 11, 2024 at 4:14 PM Gašper Ažman <gasper.azman_at_[hidden]<mailto:gasper.azman_at_[hidden]>> wrote:
dynamic_cast structures are only included for types with a vtable.

And a compile-time list of base types is included for... no types at all. Whatever the actual implementation, it will require something which isn't currently available.

All I'm saying is that asking for `any` to support taking out an instance of a base class instead of the actual class stored in it is not unreasonable.

Received on 2024-04-11 13:40:03