An Issue I Wish To Raise Awareness On

via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 20 03:28:44 PDT 2017


On Thursday, 20 July 2017 at 10:16:21 UTC, Kagamin wrote:
> On Wednesday, 19 July 2017 at 21:50:32 UTC, Petar Kirov 
> [ZombineDev] wrote:
>> Note that this doesn't play well with regular [1] value types 
>> becuase e.g. you don't have control over the synthesized 
>> bit-blit for this(this) and so you can't assume that structs 
>> with a single pointer member are updated atomically, even if 
>> would write the opAssign that way. In C++17 atomic_shared_ptr 
>> has it's copy-constructor and assign operator deleted. You can 
>> only do atomic<T> like ops with it and derive a plain 
>> shared_ptr<T> from it, kind-of like core.atomic's 
>> HeadUnshared(T).
>
> Huh? Why opAssign can't just do what atomic<T> does?

opAssign is fine, the problem is with the this(this).


More information about the Digitalmars-d mailing list