Fix allocator usage to compile with g++ 6.
This commit is contained in:
parent
6cec69ea0c
commit
503b8bb172
@ -192,14 +192,18 @@ public:
|
||||
template <class Func, class Alloc>
|
||||
void dispatch(Func&& f, const Alloc& a) const
|
||||
{
|
||||
auto p(std::allocate_shared<function<Func>>(a, std::move(f), work_count_));
|
||||
auto p(std::allocate_shared<function<Func>>(
|
||||
typename std::allocator_traits<Alloc>::template rebind_alloc<char>(a),
|
||||
std::move(f), work_count_));
|
||||
context_.do_dispatch(p, work_count_);
|
||||
}
|
||||
|
||||
template <class Func, class Alloc>
|
||||
void post(Func f, const Alloc& a) const
|
||||
{
|
||||
auto p(std::allocate_shared<function<Func>>(a, std::move(f), work_count_));
|
||||
auto p(std::allocate_shared<function<Func>>(
|
||||
typename std::allocator_traits<Alloc>::template rebind_alloc<char>(a),
|
||||
std::move(f), work_count_));
|
||||
context_.do_post(p, work_count_);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,10 @@ public:
|
||||
template <class Func, class Alloc>
|
||||
void post(Func f, const Alloc& a) const
|
||||
{
|
||||
auto p(std::allocate_shared<item<Func>>(a, priority_, std::move(f)));
|
||||
auto p(std::allocate_shared<item<Func>>(
|
||||
typename std::allocator_traits<
|
||||
Alloc>::template rebind_alloc<char>(a),
|
||||
priority_, std::move(f)));
|
||||
std::lock_guard<std::mutex> lock(context_.mutex_);
|
||||
context_.queue_.push(p);
|
||||
context_.condition_.notify_one();
|
||||
|
@ -191,14 +191,18 @@ public:
|
||||
template <class Func, class Alloc>
|
||||
void dispatch(Func&& f, const Alloc& a) const
|
||||
{
|
||||
auto p(std::allocate_shared<function<Func>>(a, std::move(f), work_count_));
|
||||
auto p(std::allocate_shared<function<Func>>(
|
||||
typename std::allocator_traits<Alloc>::template rebind_alloc<char>(a),
|
||||
std::move(f), work_count_));
|
||||
context_.do_dispatch(p, work_count_);
|
||||
}
|
||||
|
||||
template <class Func, class Alloc>
|
||||
void post(Func f, const Alloc& a) const
|
||||
{
|
||||
auto p(std::allocate_shared<function<Func>>(a, std::move(f), work_count_));
|
||||
auto p(std::allocate_shared<function<Func>>(
|
||||
typename std::allocator_traits<Alloc>::template rebind_alloc<char>(a),
|
||||
std::move(f), work_count_));
|
||||
context_.do_post(p, work_count_);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,10 @@ public:
|
||||
template <class Func, class Alloc>
|
||||
void post(Func f, const Alloc& a) const
|
||||
{
|
||||
auto p(std::allocate_shared<item<Func>>(a, priority_, std::move(f)));
|
||||
auto p(std::allocate_shared<item<Func>>(
|
||||
typename std::allocator_traits<
|
||||
Alloc>::template rebind_alloc<char>(a),
|
||||
priority_, std::move(f)));
|
||||
std::lock_guard<std::mutex> lock(context_.mutex_);
|
||||
context_.queue_.push(p);
|
||||
context_.condition_.notify_one();
|
||||
|
Loading…
Reference in New Issue
Block a user