http://d.puremagic.com/issues/show_bug.cgi?id=9062
--- Comment #10 from timon.g...@gmx.ch 2012-11-23 06:54:28 PST --- (In reply to comment #9) > (In reply to comment #8) > [snip] > > OK, I understood what you say. But implementing it in library might be much > difficult... > > --- > // An experimental implementation of timon's idea. > template PropertyTypeOf(alias prop) > { > auto ref wrapper()(){ return prop(); } > alias PropertyTypeOf = typeof(&wrapper!()); > } > > /*@property*/ int foo() @trusted nothrow { return 10;} > pragma(msg, PropertyTypeOf!foo); > // -> int function() nothrow @safe (not @trusted) > > void main() > { > struct S { /*@property*/ string bar() pure { return ""; } } > pragma(msg, PropertyTypeOf!(S.bar)); > // -> Error... > } > --- I am not sure what you are trying to do here. Anyways, the following should work: template PropertyTypeOf(alias prop) { alias PropertyTypeOf = typeof(()auto ref=>prop); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------