diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2022-06-16 07:47:44 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-06-16 08:02:02 +0100 |
commit | 4dd285fad736c014224ef2ad25b85e17f3dce1f9 (patch) | |
tree | b17a1ec96fe13890262dbeedf1d322e9e70c0043 /Lib/swig.swg | |
parent | 088dc6e8707b45872c687c980349ece6866c0bfd (diff) | |
download | swig-4dd285fad736c014224ef2ad25b85e17f3dce1f9.tar.gz |
Cosmetic rename SwigMovePointer -> SwigSmartPointer
This smart pointer doesn't really offer move semantics as is commonly
understood in C++11, so rename accordingly.
Diffstat (limited to 'Lib/swig.swg')
-rw-r--r-- | Lib/swig.swg | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/swig.swg b/Lib/swig.swg index 9978ae9b7..f6ba3a69f 100644 --- a/Lib/swig.swg +++ b/Lib/swig.swg @@ -653,8 +653,8 @@ namespace std { * arg1 = Vector(1,2,3); // Assignment from a value * * The class offers a strong guarantee of exception safety. - * With regards to the implementation, the private SwigMovePointer nested class is - * a simple smart pointer with move semantics, much like std::auto_ptr. + * With regards to the implementation, the private SwigSmartPointer nested class is + * a simple smart pointer providing exception safety, much like std::auto_ptr. * * This wrapping technique was suggested by William Fulton and is henceforth * known as the "Fulton Transform" :-). @@ -666,19 +666,19 @@ namespace std { #include <utility> /* SwigValueWrapper is described in swig.swg */ template<typename T> class SwigValueWrapper { - struct SwigMovePointer { + struct SwigSmartPointer { T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + SwigSmartPointer(T *p) : ptr(p) { } + ~SwigSmartPointer() { delete ptr; } + SwigSmartPointer& operator=(SwigSmartPointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } } pointer; SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); SwigValueWrapper(const SwigValueWrapper<T>& rhs); public: SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + SwigValueWrapper& operator=(const T& t) { SwigSmartPointer tmp(new T(t)); pointer = tmp; return *this; } #if __cplusplus >= 201103L - SwigValueWrapper& operator=(T&& t) { SwigMovePointer tmp(new T(std::move(t))); pointer = tmp; return *this; } + SwigValueWrapper& operator=(T&& t) { SwigSmartPointer tmp(new T(std::move(t))); pointer = tmp; return *this; } #endif operator T&() const { return *pointer.ptr; } T *operator&() { return pointer.ptr; } |