Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2015, 10:06:23 PM (8 years ago)
Author:
landauf
Message:

added move-constructor for StrongPtr and SharedPtr. for WeakPtr this is not useful because the weakPtr is registered in Destroyable, so a copy-constructor must be used anyway

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/object/StrongPtr.h

    r10744 r10745  
    172172            }
    173173
     174            /// Move-constructor
     175            inline StrongPtr(StrongPtr&& other) : pointer_(other.pointer_), base_(other.base_)
     176            {
     177                other.pointer_ = nullptr;
     178                other.base_ = nullptr;
     179            }
     180
    174181            /// Destructor: Decrements the reference counter.
    175182            inline ~StrongPtr()
     
    187194
    188195            /// Assigns the wrapped pointer of another StrongPtr.
    189             inline StrongPtr& operator=(const StrongPtr& other)
    190             {
    191                 StrongPtr(other).swap(*this);
     196            inline StrongPtr& operator=(StrongPtr other)
     197            {
     198                other.swap(*this);
    192199                return *this;
    193200            }
Note: See TracChangeset for help on using the changeset viewer.