POV-Ray : Newsgroups : povray.off-topic : Standard libraries : Re: Standard libraries Server Time
6 Sep 2024 13:21:25 EDT (-0400)
  Re: Standard libraries  
From: Nicolas Alvarez
Date: 6 Mar 2009 17:23:23
Message: <49b1a25a@news.povray.org>
Warp wrote:
>   The C++0x (well, C++1x, really) standard will most probably introduce
> lambda functions and closures, which addresses all these problems, and
> more. You will be able to write your function directly as a parameter
> to for_each() (or whichever generic function you want to use) as a
> lamdba function, and this lambda function can (optionally) have access
> to all the variables in scope.

std::vector<int> someList;
int total = 0;
std::for_each(someList.begin(), someList.end(), [&total](int x) {
  total += x
});
std::cout << total;

I read in a blog that Visual Studio already has *many* of those features
implemented (in a version not yet released even as alpha).

And gcc website has a list with C++0x implementation status :)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.