C++ Logo

SG7

Advanced search

Subject: Re: P1887R0 attribute predicades
From: Corentin Jabot (corentinjabot_at_[hidden])
Date: 2020-11-10 12:42:51


On Tue, 10 Nov 2020 at 18:59, Andrew Sutton <asutton.list_at_[hidden]> wrote:

> Corentin, you wrote a paper on this topic, n'est ce pas?
>

En effet!. I very much appreciate that you folded that work into yours btw.
If I remember correctly, in my design (and yours), the attribute function
returns an instance of the type directly,
I think what Cleiton is proposing is that the compiler would return a
reflection of the synthetized value

>
> Andrew
>
>
>> On Tue, 10 Nov 2020 at 15:22, Cleiton Santoia via SG7 <
>> sg7_at_[hidden]> wrote:
>>
>>> namespace std::meta {
>>> template consteval <typename Attr> // Need to be a template ?
>>> bool has_attribute(info x);
>>>
>>> template consteval <typename Attr> // template parameter only in
>>> result ?
>>> Attr attribute(info x);
>>> }
>>>
>>> Given:
>>>
>>> public X {};
>>> public Y { Y(int) {} };
>>>
>>> [[X]]
>>> struct V {};
>>> [[Y(10)]]
>>> struct W {};
>>>
>>> constexpr auto x = std::meta::attribute<X>(reflexpr(V)); // ok x = X();
>>> constexpr auto y = std::meta::attribute<Y>(reflexpr(W)); // ok y =
>>> Y(10);
>>>
>>> but what if you ask for
>>>
>>> constexpr auto y2 = std::meta::attribute<Y>(reflexpr(V)); ???
>>>
>>> since Y cannot be default initialized ?
>>>
>>
>> Program is il-formed
>>
>>
>>>
>>>
>>>
>>> I believe std::meta::attribute should a plural filtered funcion
>>>
>>> template consteval
>>> std::vector<info> attributes_of( info class_type, Args ...filters );
>>>
>>
>> How do you get a value out of the attribute ?
>>
>>
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> 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
>>
>



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

Older Archives on Google Groups