auto item_user = [](auto&& item) -> decltype(auto) { return (item.user); }; item_user(item) = my_user;
auto item_user = [](auto&& item) -> decltype(auto) requires requires { item.user;} { return (item.user); };
At least is very macroable, which would also allow to wrap it in a type with more meaning than a opaque lambda (which I agree is a good thing).
edit: Full on nonsense just for laughs:
auto user_age = [](auto&& user) noexcept (noexcept((user.age))) -> decltype(auto) requires requires { user.age;} { return (user.age); };
At least is very macroable, which would also allow to wrap it in a type with more meaning than a opaque lambda (which I agree is a good thing).
edit: Full on nonsense just for laughs: