D vs C++11
Mehrdad
wfunction at hotmail.com
Sat Nov 3 15:34:33 PDT 2012
On Saturday, 3 November 2012 at 15:06:36 UTC, mist wrote:
> Ye, that is exactly what I meant when said C++ has no real
> context capture and thus no real delegates here.
The std::function is just as "real" as any delegate.
And the variable capture [&] is just as real as in any other
language.
The only difference is that you have to manage the lifetimes of
variables instead of having a GC randomly pause your app.
So if you want to _return_ an object, you have to make sure it's
valid.
That makes it no less "real" than any other type of delegate;
it's just forcing you to think about the lifetime of the context.
Welcome to C++ I guess?
More information about the Digitalmars-d
mailing list