Date: Sat, 9 Aug 2025 21:30:37 +0200
On 09.08.25 21:06, Avi Kivity via Std-Proposals wrote:
> A modern range-based solution would look like
>
> ```c++
> auto result = input
> | std::views::transform([] (size_t sz) {
> return std::vector<int>(sz);
> }
> | std::ranges::to<std::vector>();
> ```
>
> This is still unsatisfying, as the lambda is not concise.
I disagree. The lambda is nice and readable.
Also, constructors in particular seem to have
std::initializer_list overloads occasionally,
but you can't perfectly-forward initializer lists.
Oh, and I haven't used mem_fn for ages, now that std::ranges
considers pointer-to-members invocable.
Jens
> A modern range-based solution would look like
>
> ```c++
> auto result = input
> | std::views::transform([] (size_t sz) {
> return std::vector<int>(sz);
> }
> | std::ranges::to<std::vector>();
> ```
>
> This is still unsatisfying, as the lambda is not concise.
I disagree. The lambda is nice and readable.
Also, constructors in particular seem to have
std::initializer_list overloads occasionally,
but you can't perfectly-forward initializer lists.
Oh, and I haven't used mem_fn for ages, now that std::ranges
considers pointer-to-members invocable.
Jens
Received on 2025-08-09 19:30:40