C++ Logo

std-proposals

Advanced search

Re: [std-proposals] dynamic_cast<void*>(void*)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 26 Feb 2024 14:45:31 -0600
On Monday, 26 February 2024 04:22:14 CST Frederick Virchanza Gotham via Std-
Proposals wrote:
> The point I want to make here is as follows: So long as 'v' points to
> a polymorphic type, it is not necessary to know that that type is.
> Therefore I think that the functionality of 'dynamic_cast' should be
> expanded to allow 'v' to be a pointer to void -- with the note that
> the behaviour is undefined if 'v' points to a non-polymorphic object.

And why would we want that? dynamic_cast does work on non-polymorphic types;
the fact that it knows the answer statically and you could have used
static_cast are irrelevant.

Anyway, missing a good use-case.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2024-02-26 23:24:39