Template pattern delegate?

frame frame86 at live.com
Mon Oct 26 12:28:41 UTC 2020


On Monday, 26 October 2020 at 09:25:03 UTC, Jacob Carlborg wrote:
> On Monday, 26 October 2020 at 00:56:26 UTC, frame wrote:
>
>
> If you pass the delegate as a template parameter/alias 
> parameter, it's more likely to be inlined:
>
> auto myStuff(alias fn)() {
>     try return fn();
>     catch (Exception e) { }
> }
>
> myStuff!( { /* some code */ } );
>
> --
> /Jacob Carlborg

Does not work in my case. Seems to conflict with overloads, but 
thanks for the hint.




More information about the Digitalmars-d-learn mailing list