[Issue 9062] AddrExp should distinguish the existence of property resolution.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 23 06:54:30 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9062
--- Comment #10 from timon.gehr at 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: -------
More information about the Digitalmars-d-bugs
mailing list