Commit fb4cff06 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Jakub Klinkovský
Browse files

Added swap method to the SharedPointer

parent 80260dac
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -239,6 +239,11 @@ class SharedPointer< Object, Devices::Host > : public SmartPointer
         this->free();
      }
      
      void swap( ThisType& ptr2 )
      {
         std::swap( this->pd, ptr2.pd );
      }

      ~SharedPointer()
      {
         this->free();
@@ -533,6 +538,12 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer
         this->free();
      }
      
      void swap( ThisType& ptr2 )
      {
         std::swap( this->pd, ptr2.pd );
         std::swap( this->cuda_pointer, ptr2.cuda_pointer );
      }

      ~SharedPointer()
      {
         this->free();
@@ -854,6 +865,12 @@ class SharedPointer< Object, Devices::MIC > : public SmartPointer
         this->free();
      }

      void swap( ThisType& ptr2 )
      {
         std::swap( this->pd, ptr2.pd );
         std::swap( this->mic_pointer, ptr2.mic_pointer );
      }

      ~SharedPointer()
      {
         this->free();