Remove FMT_USE_RVALUE_REFERENCES

This commit is contained in:
Victor Zverovich
2018-07-22 15:07:53 -07:00
parent 5befe6584d
commit c178ab440f
4 changed files with 12 additions and 127 deletions
+12 -18
View File
@@ -25,37 +25,31 @@ class AllocatorRef {
private:
Allocator *alloc_;
public:
typedef typename Allocator::value_type value_type;
explicit AllocatorRef(Allocator *alloc = nullptr) : alloc_(alloc) {}
AllocatorRef(const AllocatorRef &other) : alloc_(other.alloc_) {}
AllocatorRef& operator=(const AllocatorRef &other) {
alloc_ = other.alloc_;
return *this;
}
#if FMT_USE_RVALUE_REFERENCES
private:
void move(AllocatorRef &other) {
alloc_ = other.alloc_;
other.alloc_ = nullptr;
}
public:
AllocatorRef(AllocatorRef &&other) {
move(other);
}
typedef typename Allocator::value_type value_type;
explicit AllocatorRef(Allocator *alloc = nullptr) : alloc_(alloc) {}
AllocatorRef(const AllocatorRef &other) : alloc_(other.alloc_) {}
AllocatorRef(AllocatorRef &&other) { move(other); }
AllocatorRef& operator=(AllocatorRef &&other) {
assert(this != &other);
move(other);
return *this;
}
#endif
AllocatorRef& operator=(const AllocatorRef &other) {
alloc_ = other.alloc_;
return *this;
}
public:
Allocator *get() const { return alloc_; }
value_type* allocate(std::size_t n) {
-4
View File
@@ -235,8 +235,6 @@ TEST(MemoryBufferTest, Ctor) {
EXPECT_EQ(123u, buffer.capacity());
}
#if FMT_USE_RVALUE_REFERENCES
typedef AllocatorRef< std::allocator<char> > TestAllocator;
static void check_move_buffer(const char *str,
@@ -304,8 +302,6 @@ TEST(MemoryBufferTest, MoveAssignment) {
EXPECT_GT(buffer2.capacity(), 5u);
}
#endif // FMT_USE_RVALUE_REFERENCES
TEST(MemoryBufferTest, Grow) {
typedef AllocatorRef< MockAllocator<int> > Allocator;
typedef basic_memory_buffer<int, 10, Allocator> Base;