Simple implementation of __FUNCTION
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Nov 2 11:19:35 PDT 2012
On Fri, Nov 02, 2012 at 07:06:19PM +0100, Alex Rønne Petersen wrote:
> On 02-11-2012 18:31, Rob T wrote:
[...]
> >template __FUNCTION()
> >{
> > const char[] __FUNCTION = "__traits(identifier, __traits(parent, {}))";
> >}
> >
> >Example use in code:
> >
> >throw new Exception( "Error: Function ", mixin(__FUNCTION!()) );
> >
> >writefln( "File: %s, Func: %s, Line: %d", __FILE__,
> >mixin(__FUNCTION!()), __LINE__ );
[[...]
> You should totally submit this for inclusion into std.traits in Phobos.
>
> (Though, to follow naming conventions, it should be functionName and
> functionSignature or so.)
[...]
+1.
T
--
Тише едешь, дальше будешь.
More information about the Digitalmars-d
mailing list