C++ Logo


Advanced search

Re: [std-proposals] std::any::base

From: Mihail Mihaylov <mihail.mihailov_at_[hidden]>
Date: Wed, 17 Apr 2024 17:18:01 +0300
For what it's worth, I think that a free function would be better than a
method. In this way it would mimic the syntax and behavior of the
preexisting `any_cast`. Could be called `any_upcast` or something similar.
Or it could take the form of a second template argument of `any_cast` which
controls whether the match has to be exact, or derived classes are allowed.

On Mon, Apr 15, 2024 at 1:45 PM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:

> In the previous two threads entitled:
> "Extend std::type_info with more information"
> "Use the exception system to check for bases at runtime"
> People were not much interested in extending "std::type_info", but
> rather were particularly interested in adding a new member function to
> "std::any".
> Here's the beginnings of a paper for std::any::base:
> http://www.virjacode.com/papers/any_base.htm
> The implementations are provided in the paper purely just to show that
> it's possible without an ABI break. Compiler vendors will implement
> it much more efficiently.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

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-17 14:18:18