mirror of
https://github.com/fmtlib/fmt.git
synced 2026-05-05 20:14:11 +02:00
Clean core-test and fix linkage errors on older gcc
This commit is contained in:
+11
-10
@@ -9,23 +9,24 @@
|
||||
#define FMT_MOCK_ALLOCATOR_H_
|
||||
|
||||
#include "gmock.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
template <typename T>
|
||||
class MockAllocator {
|
||||
class mock_allocator {
|
||||
public:
|
||||
MockAllocator() {}
|
||||
MockAllocator(const MockAllocator &) {}
|
||||
mock_allocator() {}
|
||||
mock_allocator(const mock_allocator &) {}
|
||||
typedef T value_type;
|
||||
MOCK_METHOD1_T(allocate, T* (std::size_t n));
|
||||
MOCK_METHOD2_T(deallocate, void (T* p, std::size_t n));
|
||||
};
|
||||
|
||||
template <typename Allocator>
|
||||
class AllocatorRef {
|
||||
class allocator_ref {
|
||||
private:
|
||||
Allocator *alloc_;
|
||||
|
||||
void move(AllocatorRef &other) {
|
||||
void move(allocator_ref &other) {
|
||||
alloc_ = other.alloc_;
|
||||
other.alloc_ = nullptr;
|
||||
}
|
||||
@@ -33,18 +34,18 @@ class AllocatorRef {
|
||||
public:
|
||||
typedef typename Allocator::value_type value_type;
|
||||
|
||||
explicit AllocatorRef(Allocator *alloc = nullptr) : alloc_(alloc) {}
|
||||
explicit allocator_ref(Allocator *alloc = nullptr) : alloc_(alloc) {}
|
||||
|
||||
AllocatorRef(const AllocatorRef &other) : alloc_(other.alloc_) {}
|
||||
AllocatorRef(AllocatorRef &&other) { move(other); }
|
||||
allocator_ref(const allocator_ref &other) : alloc_(other.alloc_) {}
|
||||
allocator_ref(allocator_ref &&other) { move(other); }
|
||||
|
||||
AllocatorRef& operator=(AllocatorRef &&other) {
|
||||
allocator_ref& operator=(allocator_ref &&other) {
|
||||
assert(this != &other);
|
||||
move(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
AllocatorRef& operator=(const AllocatorRef &other) {
|
||||
allocator_ref& operator=(const allocator_ref &other) {
|
||||
alloc_ = other.alloc_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user