C++ Logo

SG7

Advanced search

Subject: Re: P2320 implementation
From: Peter Dimov (pdimov_at_[hidden])
Date: 2021-03-16 18:26:48


Hana Dusíková wrote:
> Hi,
>
> as some of you already asked me directly:
>
> https://github.com/lock3/meta/tree/paper/p2320 is current implementation
> of P2320, you can also try it in the Compiler Explorer:
>
> https://cppx.godbolt.org/z/TfTTa9 (language: cppx, compiler: p2320 trunk)
>
> Thanks Andrew and Wyatt for awesome work! 🌷

Ditto, and thanks Hana for the link.

I've been trying to try things, and here's where I'm stuck at the moment:
https://cppx.godbolt.org/z/T8f7eo

#include <experimental/meta>
namespace meta = std::experimental::meta;

enum E
{
    e1, e2
};

int main()
{
    constexpr auto m = meta::members_of( ^E );
    for constexpr (auto x: m) { constexpr char const * name = meta::name_of( x ); }
    constexpr char const * names[] = { meta::name_of(...[:m:])... };
}

Neither the `for constexpr` loop, nor the range expansion below it compile. I'm
obviously doing something wrong, but I don't know what - the `for constexp` loop
is directly taken from the P1240 examples, and the expansion below it ought to
work according to my reading of P2320.

What's my mistake?


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

Older Archives on Google Groups