Reputation: 42255
I want to use ranges-v3
to transform an array in place. I can use
ranges::transform
successfully, but failed to use actions::transform
.
int arr[]{1, 2, 3};
auto fn = [](auto e) { return e + 1; };
ranges::transform(arr, std::begin(arr), fn); // ok
arr |= actions::transform(std::begin(arr), fn); // error
Error Message:
fatal error: no matching function for call to object of type 'const ranges::actions::transform_fn'
arg |= actions::transform(std::begin(arr), std::begin(arr),
^~~~~~~~~~~~~~~~~~
How to use actions::transform
in such a case?
Upvotes: 1
Views: 808