3 ms·
What are you talking about? You're missing an arg in your transform() call. int nums[] = {1, 2, 3}; printf("nums: %i %i %i\n", nums[0], nums[1], nums[2]);
by Jach 17y ago
What are you talking about? You're missing an arg in your transform() call.
int nums[] = {1, 2, 3};
printf("nums: %i %i %i\n", nums[0], nums[1], nums[2]);
std::transform(nums, nums+3, nums, (lambda<int> (x) --> 2*x));
printf("new nums: %i %i %i\n", nums[0], nums[1], nums[2]);
Edit: And of course, there's the implemented map he gives in the example:
int* incs = (lambda<int> (x) --> x + 1).map(3,nums);
The class needs a little bit of work obviously (like more operators overloaded), but it's pretty nice.