Date: Tue, 02 Apr 2024 17:03:28 +0000
Frederick Virchanza Gotham wrote:
> You have a variable of type std::any. You want to check if the
> contained value is derived from 'std::exception', and if it is, you
> want to return the 'what()' string.
> At runtime, if you give me the address of an object along with its
> type_info, I can confirm for you if any given class is one of its base
> classes, and if it is, I'll give you a pointer to the base class. The
> pointer will be appropriately adjusted in cases of multiple
> inheritance.
Please see my thread from last year with subject "Get base class from std::any":
https://lists.isocpp.org/std-proposals/2023/03/6082.php
I agree that this would be a useful feature to have in the language.
Regards, Phil.
> You have a variable of type std::any. You want to check if the
> contained value is derived from 'std::exception', and if it is, you
> want to return the 'what()' string.
> At runtime, if you give me the address of an object along with its
> type_info, I can confirm for you if any given class is one of its base
> classes, and if it is, I'll give you a pointer to the base class. The
> pointer will be appropriately adjusted in cases of multiple
> inheritance.
Please see my thread from last year with subject "Get base class from std::any":
https://lists.isocpp.org/std-proposals/2023/03/6082.php
I agree that this would be a useful feature to have in the language.
Regards, Phil.
Received on 2024-04-02 17:03:30