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@lists.isocpp.org> 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@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg7