On 23 February 2015 at 06:49, Walter Bright via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
> On 2/22/2015 8:15 AM, Manu via Digitalmars-d wrote:
>>
>> I can't overload on 'scope'. How can I create a scope
>> constructor/destructor/postblit that doesn't perform the ref fiddling?
>
>
> I don't understand what you're trying to do.

struct RCThing
{
  RefType *instance;

  this(this) { IncRef(instance); }
  ~this() { DecRef(instance); }

  this(this) scope {} // <- scope instances don't need ref fiddling
  ~this() scope {}
}

Or various permutations along those lines.
Ie, library types may eliminate their ref fiddling when they are scope.

Reply via email to