Re: ReturnType of lambda templates

2015-08-18 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 18 August 2015 at 14:25:34 UTC, Roland Hadinger wrote: Hi! Suppose I wanna do this (which already works, which is why D is pretty cool): import std.traits; import std.typecons : Nullable; // Retrofit Nullable to allow for monadic chaining // auto apply( alias

ReturnType of lambda templates

2015-08-18 Thread Roland Hadinger via Digitalmars-d-learn
Hi! Suppose I wanna do this (which already works, which is why D is pretty cool): import std.traits; import std.typecons : Nullable; // Retrofit Nullable to allow for monadic chaining // auto apply( alias fun, T )( Nullable!T nullable ) if( isSomeFunction!fun )

Re: ReturnType of lambda templates

2015-08-18 Thread Roland Hadinger via Digitalmars-d-learn
On Tuesday, 18 August 2015 at 15:11:34 UTC, John Colvin wrote: for simple lambdas like that (i.e. function templates with one template arguments that corresponds to the type of the first and only argument), just add this template overload: auto apply( alias fun, T )( Nullable!T nullable )