微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

没有函数模板“ThreadPool::enqueue”的实例与参数列表匹配——参数类型是:(void *(*)(void *Arg), void *)

如何解决没有函数模板“ThreadPool::enqueue”的实例与参数列表匹配——参数类型是:(void *(*)(void *Arg), void *)

我正在为线程池编写代码,编译后出现错误

没有函数模板 ThreadPool::enqueue 的实例匹配参数列表——参数类型是:(void (shih_tzu::AuthCtl::AuthController::)(void *Arg),void *)

线程池.h

template<typename F,typename...Args>
auto ThreadPool::enqueue(F&& f,Args&&... args) -> std::future<decltype(f(args...))>
  {
    std::function<decltype(f(args...))() > func = std::bind(std::forward<F>(f),std::forward<Args>(args)...);
    auto task_ptr = std::make_shared < std::packaged_task<decltype(f(args...))()>>(func);
    std::function<void() > wrapper_func = [task_ptr]()
    {
      (*task_ptr)();
    };
    mTasks.emplace(wrapper_func);
     debugLog->PrintLog("Inside Thread pool enqueue function insert new function call\n");
    cv.notify_one();
    return task_ptr->get_future();
  }

调用入队

thread_pool->enqueue(&AuthController::WorkerFunction,(void *)sThreadStruct1); //error here

WorkerFunction 签名:-

void* AuthController::WorkerFunction(void *Arg)

请帮我解决这个编译时问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。