On 10/01/2012 19:56, Jacob Carlborg wrote:
<snip>
A template parameter with a template constraint will accept any callable type. 
Function
pointer, delegate, struct/class overloading the call operator and so on.

Indeed, this is done in the C++ STL quite a lot.

The drawback is that templated methods lose their virtuality, because it cannot be known in advance on what types the template will be instantiated in order to populate the vtable.

FWIW my utility library includes a delegate wrapper:
http://pr.stewartsplace.org.uk/d/sutil/

(dgwrap works in both D1 and D2, though other bits of the library need updating 
to current D2)

Stewart.

Reply via email to