[Allocator] Make SpecificBumpPtrAllocator also movable and move

assignable.

llvm-svn: 206448
This commit is contained in:
Chandler Carruth 2014-04-17 07:08:56 +00:00
parent 0a9bf4c0c5
commit 75f2ca4787
1 changed files with 7 additions and 3 deletions

View File

@ -365,9 +365,15 @@ template <typename T> class SpecificBumpPtrAllocator {
public:
SpecificBumpPtrAllocator() : Allocator() {}
SpecificBumpPtrAllocator(SpecificBumpPtrAllocator &&Old)
: Allocator(std::move(Old.Allocator)) {}
~SpecificBumpPtrAllocator() { DestroyAll(); }
SpecificBumpPtrAllocator &operator=(SpecificBumpPtrAllocator &&RHS) {
Allocator = RHS.Allocator;
return *this;
}
/// Call the destructor of each allocated object and deallocate all but the
/// current slab and reset the current pointer to the beginning of it, freeing
/// all memory allocated so far.
@ -400,8 +406,6 @@ public:
/// \brief Allocate space for an array of objects without constructing them.
T *Allocate(size_t num = 1) { return Allocator.Allocate<T>(num); }
private:
};
} // end namespace llvm