C++ Logo


Advanced search

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

From: Gašper Ažman <gasper.azman_at_[hidden]>
Date: Thu, 11 Apr 2024 13:21:18 +0100
std::any type-erases the copy ctor and the dtor of the encapsulated type.
It does that on assignment, and codegens that bit of the rtti needed to
recover with get.

all you need is some way to get a typelist of bases and you can codegen the
code, on assignment. You *already* have to do that in a compilation unit
where the full definition of the stored class is available. You can ask for
it in a compilation unit where only a forward-decl is available, and that's
alright, you'll be going through an extern template that you generated in
the other compilation unit.

It's really not difficult if you've ever done your own type-erasure.

On Thu, Apr 11, 2024 at 1:16 PM Mihail Mihaylov via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> How about y'all just wait for reflection that'll let you enumerate all
>> that stuff at compile-time and then codegen what you need. No need for
>> weird type_info-based shenanigans.
> How will compile-time codegen allow us to handle derived types for which
> the declaration and definition are not available in the current translation
> unit?
> This electronic communication and the information and any files
> transmitted with it, or attached to it, are confidential and are intended
> solely for the use of the individual or entity to whom it is addressed and
> may contain information that is confidential, legally privileged, protected
> by privacy laws, or otherwise restricted from disclosure to anyone else. If
> you are not the intended recipient or the person responsible for delivering
> the e-mail to the intended recipient, you are hereby notified that any use,
> copying, distributing, dissemination, forwarding, printing, or copying of
> this e-mail is strictly prohibited. If you received this e-mail in error,
> please return the e-mail to the sender, delete it from your computer, and
> destroy any printed copy of it.--
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-04-11 12:21:35