sigh: rebind allocator internally
This commit is contained in:
@@ -57,6 +57,9 @@ class sigh<Ret(Args...), Allocator> {
|
||||
/*! @brief A sink is allowed to modify a signal. */
|
||||
friend class sink<sigh<Ret(Args...), Allocator>>;
|
||||
|
||||
using alloc_traits = std::allocator_traits<Allocator>;
|
||||
using container_type = std::vector<delegate<Ret(Args...)>, typename alloc_traits::template rebind_alloc<delegate<Ret(Args...)>>>;
|
||||
|
||||
public:
|
||||
/*! @brief Allocator type. */
|
||||
using allocator_type = Allocator;
|
||||
@@ -215,7 +218,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<delegate<Ret(Args...)>, Allocator> calls;
|
||||
container_type calls;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <gtest/gtest.h>
|
||||
#include <entt/signal/sigh.hpp>
|
||||
#include "../common/throwing_allocator.hpp"
|
||||
|
||||
struct sigh_listener {
|
||||
static void f(int &v) {
|
||||
@@ -531,7 +531,7 @@ TEST_F(SigH, UnboundMemberFunction) {
|
||||
}
|
||||
|
||||
TEST_F(SigH, CustomAllocator) {
|
||||
test::throwing_allocator<entt::delegate<void(int)>> allocator;
|
||||
std::allocator<void (*)(int)> allocator;
|
||||
|
||||
auto test = [&](auto curr) {
|
||||
ASSERT_EQ(curr.get_allocator(), allocator);
|
||||
|
||||
Reference in New Issue
Block a user