In c++11 auto_ptr
is deprecated and replaced with the more sensible unique_ptr
. Alas if you use boost::ptr_map
the auto_ptr
fulfilled a very handy use:
std::auto_ptr<Layer> pLayer(new Layer());
mRawLayerPtrMap.insert(layerName,pLayer);
Is there a possibility to use something similar with c++11. I know that
Layer* pLayer = new Layer();
mFusedLayers.insert(fusedLayerName,pLayer);
works but the auto_ptr
had it's merits in some more complicated scenarios.
Is there a replacement that works with C++11 ?
How about
std::unique_ptr<Layer> pLayer(new Layer());
mFusedLayers.insert(fusedLayerName,pLayer.release());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With