It’s getting increasingly difficult to integrate cocos2d-x with the CCRef memory model into new c++11/c++14 libraries that are standardizing on std::shared_ptr for shared memory management.
Copy semantics often need to work for lambda functions that share ownership of objects that are captured. Especially when these lambdas may in turn be copied themselves.
I’ve created a pull request here, that allows any CCRef to be used as a shared_ptr as well as managed by the cocos2d-x memory model. It’s not ideal, but it’s a solution to use both models correctly:
Note, this only works if you exclusively use the shared_ptr generator function of the CCRef…