CBaquero / delta-enabled-crdts

Reference implementations of state-based CRDTs that offer deltas for all mutations.
Apache License 2.0
318 stars 36 forks source link

move shared context to shared_ptr #12

Open AlexDovgan opened 9 months ago

AlexDovgan commented 9 months ago

Using C++ references for access to shared context did not implemented correctly. For correct work, the CRDT objects should not support copy semantic, just a move semantic should be supported. In current implementation on debug build in VS we get an exception, cause compiler not implement copy elision optimization, the copy constructor is calling when delta is creating and returning so code is crashing. For correct copy semantics supporting I implemented context as the std::shared_ptr.