|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-20 20:04:15
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk