A comparison between C++ and D
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Wed Mar 9 14:05:28 PST 2016
On Wednesday, 9 March 2016 at 20:41:35 UTC, bigsandwich wrote:
> Right, I used to this sort of thing in C++ prior to C++11. I
> think not having an RAII wrapper for lambdas similar to
> std::function<> is an oversight for D, especially for people
> averse to GC. That little bit of syntactic sugar makes a huge
> difference.
std::function<> is a lot more than syntactic sugar, it is a
runtime-heavy construct. From
http://en.cppreference.com/w/cpp/utility/functional/function :
«Class template std::function is a general-purpose polymorphic
function wrapper. Instances of std::function can store, copy, and
invoke any Callable target -- functions, lambda expressions, bind
expressions, or other function objects, as well as pointers to
member functions and pointers to data members.»
I don't think you want this...
More information about the Digitalmars-d
mailing list