Date: Mon, 8 Apr 2024 08:00:46 +0100
But again - why? Just use typeid(type) instead of typeid(expression)
On Mon, Apr 8, 2024, 07:29 Jens Maurer via Std-Proposals <
std-proposals_at_[hidden]> wrote:
>
>
> On 08/04/2024 07.47, Frederick Virchanza Gotham via Std-Proposals wrote:
> > On Sun, Apr 7, 2024 at 9:19 PM Jens Maurer wrote:
> >>
> >> struct Base { };
> >> struct Derived {};
> >
> > I'm guessing you meant
> >
> > struct Derived : Base {};
>
> Yes.
>
> >> int f(Base * b) { // not a template
> >> typeid(*b); // yields std::type_info object for "Derived"
> >> return 0;
> >> }
> >>
> >> int x = f(new Derived);
> >
> >
> > With regard to the member function std::type_info::is_polymorphic
>
> I wasn't asking about this. I was specifically asking about the
> idea that, instead of a built-in operator "typeid", we should just
> have a template get_type_id<T>
>
> Jens
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
On Mon, Apr 8, 2024, 07:29 Jens Maurer via Std-Proposals <
std-proposals_at_[hidden]> wrote:
>
>
> On 08/04/2024 07.47, Frederick Virchanza Gotham via Std-Proposals wrote:
> > On Sun, Apr 7, 2024 at 9:19 PM Jens Maurer wrote:
> >>
> >> struct Base { };
> >> struct Derived {};
> >
> > I'm guessing you meant
> >
> > struct Derived : Base {};
>
> Yes.
>
> >> int f(Base * b) { // not a template
> >> typeid(*b); // yields std::type_info object for "Derived"
> >> return 0;
> >> }
> >>
> >> int x = f(new Derived);
> >
> >
> > With regard to the member function std::type_info::is_polymorphic
>
> I wasn't asking about this. I was specifically asking about the
> idea that, instead of a built-in operator "typeid", we should just
> have a template get_type_id<T>
>
> Jens
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2024-04-08 07:00:59