with (auto p = new ...)

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 23 09:12:59 PDT 2014


On Tuesday, 23 September 2014 at 15:19:59 UTC, Andre wrote:
> I just wonder why "with (auto p = new ...)" is not working.
> It would be some syntax sugar in this scenario:

I presume with is limited to expressions and not statements as 
the messages says.

However, you can use

  	if (auto p = new Panel())

instead as long as the new doesn't fail, that is you still have 
memory left :)


More information about the Digitalmars-d-learn mailing list