C++ Logo

std-proposals

Advanced search

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

From: Mihail Mihaylov <mihail.mihailov_at_[hidden]>
Date: Thu, 11 Apr 2024 16:50:03 +0300
On Thu, Apr 11, 2024 at 4:40 PM Arthur O'Dwyer via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> If you want to make a type-erased `my::Any` where one of the type-erased
> affordances is "any_cast to base," that's totally possible.
> I show exactly how to do it in my "Back to Basics: Type Erasure"
> <https://www.youtube.com/watch?v=tbUCHifyT24&t=2210s> from 2019.
> Basically, *any operation you can think of* can be turned into an
> affordance and type-erased, as long as you're willing to write your own
> type-erased type. (Which is easy and everyone should know how to do it. :)
> See "Type-erased UniquePrintable and PrintableRef"
> <https://quuxplusone.github.io/blog/2020/11/24/type-erased-printable/>
> from November 2020.)
>

Yes, I know how to write type-erasure and I've done it several times when
the occasion asked for it.

Relying on exceptions to do the cast can make this a library-only change,
but is it considered acceptable?

-- 
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.

Received on 2024-04-11 13:50:16