On Thursday, 11 June 2015 at 19:23:49 UTC, Ali Çehreli wrote:
On 06/11/2015 11:43 AM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 17:34:56 UTC, Steven Schveighoffer wrote:
On 6/11/15 1:28 PM, Yuxuan Shui wrote:
On Thursday, 11 June 2015 at 09:11:47 UTC, Daniel Kozák wrote:

On Thu, 11 Jun 2015 09:01:04 +0000
Yuxuan Shui via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com>
wrote:
  A x = scoped!A(10);

use auto x = scoped!A(10);

Thanks!

Curious question, why doesn't compiler reject this code?

Because scoped!A implicitly casts to A.

-Steve

Thanks!

I just found that out myself. Learned 'alias this' in the process.

Shameless plug: :)

  http://ddili.org/ders/d.en/destroy.html#ix_destroy.scoped

This issue is explained at the end of that section.

Ali

Can you explain more about why the destructor is not called when returning a struct?

Can't seem to find it in the document.

Reply via email to