Skip to content

Why does the function with arguments have errors? #23

Description

@mirro187

Error C2672: "CTPL ::thread_pool::push" : no matching overloaded function found
Error C2780: "STD ::future : CTPL ::thread_pool::push(F &&)" : one parameter should be input, but two are provided
Error C2893: function template "STD ::future CTPL ::thread_pool::push(F &&,Rest &&...) "specialty
Error C2672: "STD ::vector< STD ::future, STD ::allocator<_Ty> : >::emplace_back" : overloaded function not found

#include "ctpl_stl.h"
#include "iostream"
#include "string"

void f(int j)
{
std::cout << j << std::endl;

}

int main(int argc, char **argv) {

ctpl::thread_pool p(8 /* two threads in the pool */);

std::vector< std::future<int> > results;

for (int i = 0; i < 8; ++i) {
	results.emplace_back(
		p.push(f, i));
}

for (auto && result : results)
	std::cout << result.get() << ' ';
std::cout << std::endl;
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