how to create a local copy of shared pointer?

thedeemon dlang at thedeemon.com
Mon Oct 15 08:27:02 PDT 2012


On Monday, 15 October 2012 at 15:15:57 UTC, denizzzka wrote:
>     S* s = new shared (S); // Why this is a illegal?
> Error: cannot implicitly convert expression (new shared(S)) of 
> type shared(S)* to S*

Because shared(S) and S are different types. Either declare s as 
shared too or use a cast.


More information about the Digitalmars-d-learn mailing list