Is there any way to invoke a user defined literal on lvalues?
e.g I would like to
int operator \"\" _xor1(int a) { return a^1; }
// Works fine
17_xor1;
No, you cannot invoke a user-defined literal on a variable populated at runtime. Nor do you need to. Just define a standalone function that different pieces of code can invoke when needed, eg:
template
T do_xor1(T a) { return a^1; }
int operator "" _xor1(unsigned long long a) { return do_xor1(a); }
// Works fine
17_xor1;
auto myint = get_something_only_availabe_at_runtime();
do_xor1(myint);