Skip to content

Why does the function with arguments have errors? #26

Description

@mirro187

error C2660 “std::packaged_task<int (int)>::operator ()”: The function does not take zero arguments

#include "thread_pool.hpp"
#include  "thread"
#include "future"
#include "functional"
#include "memory"
#include "iostream"
using namespace std;

int f(int j)
{
	return j;
}

int main(int argc, char **argv)
{
	tp::ThreadPool pool;
	//
	std::packaged_task<int(int)> t(f);
	std::future<int> r = t.get_future();
	pool.post(t);
	r.get();
	//while (1);
	getchar();
	return 0;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions