Get calling this, if exists
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 23 20:04:25 PDT 2016
On Friday, 24 June 2016 at 02:57:28 UTC, "Smoke" Adams wrote:
> Is there a type of __THIS__ construct similar to __FILE__ and
> __LINE__?
>
> Something that returns the current this ptr if it exists, null
> otherwise.
>
> Log(string filename = __FILE__, Object obj = __THIS__)()
> {
> // inspect obj and do stuff
> }
There is no 'this' pointer unless you are calling a member
function on an aggregate, so you can never have one that is null.
More information about the Digitalmars-d-learn
mailing list