C++ Logo

sg7

Advanced search

UDL and operators reflection syntax

From: Cleiton Santoia <cleitonsantoia_at_[hidden]>
Date: Sun, 20 Feb 2022 22:20:44 -0300
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

Received on 2022-02-21 01:20:57