mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 23:24:59 +00:00
Add move constructors for OwningPtr and OwningArrayPtr.
While LLVM itself is still C++03, there's no reason why tools built on top of it can't use C++11 features. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166242 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -32,6 +32,15 @@ class OwningPtr {
|
|||||||
public:
|
public:
|
||||||
explicit OwningPtr(T *P = 0) : Ptr(P) {}
|
explicit OwningPtr(T *P = 0) : Ptr(P) {}
|
||||||
|
|
||||||
|
#if LLVM_USE_RVALUE_REFERENCES
|
||||||
|
OwningPtr(OwningPtr &&Other) : Ptr(Other.take()) {}
|
||||||
|
|
||||||
|
OwningPtr &operator=(OwningPtr &&Other) {
|
||||||
|
reset(Other.take());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
~OwningPtr() {
|
~OwningPtr() {
|
||||||
delete Ptr;
|
delete Ptr;
|
||||||
}
|
}
|
||||||
@@ -86,6 +95,15 @@ class OwningArrayPtr {
|
|||||||
public:
|
public:
|
||||||
explicit OwningArrayPtr(T *P = 0) : Ptr(P) {}
|
explicit OwningArrayPtr(T *P = 0) : Ptr(P) {}
|
||||||
|
|
||||||
|
#if LLVM_USE_RVALUE_REFERENCES
|
||||||
|
OwningArrayPtr(OwningArrayPtr &&Other) : Ptr(Other.take()) {}
|
||||||
|
|
||||||
|
OwningArrayPtr &operator=(OwningArrayPtr &&Other) {
|
||||||
|
reset(Other.take());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
~OwningArrayPtr() {
|
~OwningArrayPtr() {
|
||||||
delete [] Ptr;
|
delete [] Ptr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user