C++ Logo

SG7

Advanced search

Subject: Re: Incomplete types
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2020-11-03 07:47:10


On Mon, Nov 2, 2020 at 11:40 PM Cleiton Santoia via SG7 <
sg7_at_[hidden]> wrote:

> Sorry, I made few mistakes, let me be more clear:
> Can the reflexpr operator in #2 "see" members of class X before reflexpr
> usage like decltype ?
>
> consteval auto get_member_types(info classtype) {
> auto result = members_of(classtype); // #1 members_of can see
> incomplete class members ?
> for (auto &info : result) {
> info = type_of(info);
> // I suppose this line converts 'int X::*' to 'int'
> }
> return result;
> };
>
> struct X {
> int a;
> bool b;
> char c;
> // so far we have 3 members...
> std::variant< typename( get_member_types( reflexpr (X) ) ) > d; // #2
> can reflexpr see previous 3 members ? ( goto #1 )
> };
>
> Is the type of d "variant<int, bool, char>" ? Is this illegal ?
>

Yes, I believe it should be. Except:

for (auto info : result) // no reference

and the implementation doesn't currently support expansion of reifer/splice
operations. You should have to write:

typename(get_member_types(x))...

or in P2237

|get_member_types(x)|...



SG7 list run by sg7-owner@lists.isocpp.org

Older Archives on Google Groups