How does D improve design practices over C++?

Walter Bright newshound1 at digitalmars.com
Thu Nov 6 23:42:20 PST 2008


Bill Baxter wrote:
> C++ doesn't have "delegates".  It has member function pointers.  I
> don't think that's changed.  boost::bind (now std::tr1::bind in some
> places) gives you a way to bundle a member function pointer with an
> object pointer in a delegate-like way, but I don't think anybody calls
> those delegates.  At least they didn't used to.

The difference between D delegates and boost::bind for member functions 
is that D delegates bind to the specific virtual function when the 
delegate is created, while boost::bind binds when the delegate is 
called. The former is, of course, more efficient when the delegate gets 
called more than once.



More information about the Digitalmars-d mailing list