Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: