fix gcc 4.9 unit test compilation

This commit is contained in:
2019-05-05 09:21:25 +07:00
parent a5ecda71bb
commit 347bd3e756
2 changed files with 42 additions and 0 deletions

View File

@@ -17,8 +17,20 @@ namespace
template < typename T >
class dummy_allocator {
public:
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using const_pointer = const T*;
using reference = T&;
using const_reference = const T&;
using value_type = T;
using propagate_on_container_move_assignment = std::true_type;
using is_always_equal = std::true_type;
template < typename U >
struct rebind { using other = dummy_allocator<U>; };
dummy_allocator() = default;
dummy_allocator(int i) : i(i) {}
@@ -36,6 +48,15 @@ namespace
std::free(p);
}
template < typename U, typename... Args >
void construct(U* p, Args&&... args) {
::new((void*)p) U(std::forward<Args>(args)...);
}
void destroy(pointer p) {
p->~T();
}
int i = 0;
};

View File

@@ -17,8 +17,20 @@ namespace
template < typename T >
class dummy_allocator {
public:
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using const_pointer = const T*;
using reference = T&;
using const_reference = const T&;
using value_type = T;
using propagate_on_container_move_assignment = std::true_type;
using is_always_equal = std::true_type;
template < typename U >
struct rebind { using other = dummy_allocator<U>; };
dummy_allocator() = default;
dummy_allocator(int i) : i(i) {}
@@ -36,6 +48,15 @@ namespace
std::free(p);
}
template < typename U, typename... Args >
void construct(U* p, Args&&... args) {
::new((void*)p) U(std::forward<Args>(args)...);
}
void destroy(pointer p) {
p->~T();
}
int i = 0;
};