C++ Logo

sg7

Advanced search

Re: Status of P1306 - Expansion Statements

From: Hubert Tong <hubert.reinterpretcast_at_[hidden]>
Date: Mon, 21 Feb 2022 12:46:23 -0500
On Mon, Feb 21, 2022 at 12:42 PM Jonathan O'Connor via SG7
<sg7_at_[hidden]> wrote:
>
> Folks,
> P1240R2 mentions the use of `template for` as an expansion statement. It seems there has been no progress on this paper for a few years.Does it fall under our special group, or is it being dealt with elsewhere? It was mentioned that it almost made it into C++20, but I fear it has no chance of making it into C++23.

CWG has reviewed a revision of it recently.

>
> Regards,
> Jonathan O'Connor
>
>
> ------- Original Message -------
> On Monday, February 21st, 2022 at 06:18, Matus Chochlik via SG7 <sg7_at_[hidden]> wrote:
>
> Hi,
>
> its:
>
> #include <experimental/reflect>
>
> auto operator""_s(unsigned long long v) {
> return v * 2;
> }
>
> namespace meta = std::experimental::reflect;
>
> using r1 = reflexpr(( 12_s ));
> using r2 = meta::get_subexpression_t<r1>;
> using r3 = meta::get_callable_t<r2>;
>
> int main() {
> static_assert(meta::ParenthesizedExpression<r1>);
> static_assert(meta::FunctionCallExpression<r2>);
> static_assert(meta::Callable<r3>);
> return 0;
> }
>
> see: https://compiler-explorer.com/z/oY1E53GEo
>
> BR,
> --Matus
>
> On Mon, Feb 21, 2022 at 2:20 AM Cleiton Santoia via SG7 <sg7_at_[hidden]> wrote:
>>
>>
>> I´m trying to guess the syntax for reflecting operators and UDL´s, but failed :(
>>
>> struct X {};
>> auto operator+(X,X) { return X{}; }
>> auto operator""_s(unsigned long long v) { return v * 2; }
>> constexpr X x1, x2;
>>
>> using r1 = reflexpr( operator+(X,X) );
>> using r2 = reflexpr( x1 + x2 );
>> using r3 = reflexpr( operator""_s(unsigned long long v) );
>> using r4 = reflexpr( 12_s );
>> https://compiler-explorer.com/z/hWP93dbW7
>>
>> <source>:11:22: error: operator cannot be used as argument for the reflexpr operator
>> using r1 = reflexpr( operator+(X,X) );
>>
>>
>> Is any of these syntaxes right ?
>> Is this available already ?
>>
>>
>> []
>> Cleiton
>>
>> --
>> 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-02-21 17:46:52