
20 Dec
2024
20 Dec
'24
8:04 p.m.
Neil Groves wrote:
I have working on a private branch (without new member functions in any associative container):
users | mapped_values(user_id) | invoke([](user_type& user) { user.status = deactivated; });
To me, this looks remarkably similar to your example.
That's the best I can do using the standard ranges: https://godbolt.org/z/WMrzszMGP But it's not the same as the original example, because it doesn't return the found user. There might be a way to say something like `| views::front` that will make the pipeline return .front(), but I don't know what it is. You can say `| views::take(1)` but that's still a range. `| views::to<optional<user_type>>` would work if it worked, but I don't think it does.