C++ Logo

sg7

Advanced search

Re: Update: P1240R2 — Scalable Reflection - Clarifications

From: Daveed Vandevoorde <daveed_at_[hidden]>
Date: Mon, 31 Jan 2022 11:27:26 -0500
> On Jan 30, 2022, at 7:49 AM, Jonathan O'Connor via SG7 <sg7_at_[hidden]> wrote:
>
> Hi all,
>
> These should be simple to answer and not generate any discussion.
>
> Page 4, under Implementation status:
> Should Matus Chochlik's Clang fork be listed?

Unless things have changed, I believe Matúš’ is an implementation of the TS, not this proposal.


>
> Page 14, second code block:
> Why is the enum E and the function d() declared here? They are not used in the discussion of the code block
> and I spent some time wondering about their relevance.

Ah yes, I think that’s a leftover. Thanks for bringing it to our attention.

>
> Page 15, first code block:
> Why is the enum E and the function d() declared here? They are not used in the discussion of the code block
> and I spent some time wondering about their relevance.

Ditto.

>
> Page 33, parent_of function
> What happens when calling parent_of on a class with multiple base classes? E.g.
>
> class A{}:
> class B{};
> class M : public A, public B {};
>
> auto parentOfM = meta::parent_of(^M); // Is that valid?

“parent_of” is a way to get to the entity that directly owns the entity being reflected by the operand.

So in your example,

 parent_of(^A) == ^::
 parent_of(^B) == ^::
 parent_of(^M) == ^::

Note that “a base class” in C++ is not the same as “the type of a base class”. A base class is closer to “a data member”: It describes a subobject designation.
With that in mind:

 parent_of(bases_classes_of(^M)[0]) == ^M
 parent_of(bases_classes_of(^M)[1]) == ^M

 Daveed


>
>
> Regards,
> Jonathan
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Saturday, January 15th, 2022 at 17:41, Daveed Vandevoorde via SG7 <sg7_at_[hidden]> wrote:
>
>> SG7 mailing list
>>
>> SG7_at_[hidden]
>>
>> https://lists.isocpp.org/mailman/listinfo.cgi/sg7
> --
> SG7 mailing list
> SG7_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg7

Received on 2022-01-31 16:27:28