On Thursday, 11 June 2020 at 05:41:25 UTC, H. S. Teoh wrote:
Ironically, just today I ran into this corner case where @property actually became a solution to a real problem://-----module1.d------ auto someGenericFunc(T)(T t) { ... static if (is(typeof(T.init.method) : T)) { R someRange = ...; // ElementType!R == T auto value = someRange.map!(e => e.method); } ... }
Personally I like the way Phobos does it:
ReturnType!((T t) => t.method)
This works for both @property and non-@property methods.
