diff Framework/Radiography/RadiographyDicomLayer.cpp @ 1299:c38c89684d83 broker

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 17:21:24 +0100
parents 68579a31eeb4
children 257f2c9a02ac
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyDicomLayer.cpp	Sun Feb 23 15:32:24 2020 +0100
+++ b/Framework/Radiography/RadiographyDicomLayer.cpp	Mon Mar 02 17:21:24 2020 +0100
@@ -98,7 +98,7 @@
 
   void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image)   // Takes ownership
   {
-    std::auto_ptr<Orthanc::ImageAccessor> raii(image);
+    std::unique_ptr<Orthanc::ImageAccessor> raii(image);
 
     if (image == NULL)
     {
@@ -107,7 +107,12 @@
 
     SetSize(image->GetWidth(), image->GetHeight());
 
-    source_ = raii;
+#if __cplusplus < 201103L
+    source_.reset(raii.release());
+#else
+    source_ = std::move(raii);
+#endif
+
     ApplyConverter();
 
     BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
@@ -115,7 +120,7 @@
 
   void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY, bool emitLayerEditedEvent)   // Takes ownership
   {
-    std::auto_ptr<Orthanc::ImageAccessor> raii(image);
+    std::unique_ptr<Orthanc::ImageAccessor> raii(image);
 
     if (image == NULL)
     {
@@ -124,7 +129,12 @@
 
     SetSize(image->GetWidth(), image->GetHeight(), false);
 
-    source_ = raii;
+#if __cplusplus < 201103L
+    source_.reset(raii.release());
+#else
+    source_ = std::move(raii);
+#endif
+
     ApplyConverter();
 
     SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false);