I'm trying to use C++ executor. This is the code I found in https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0443r14.html. It should be supported by gcc 11.
I compiled this code with command
g++-11 main.cpp -ltbb
#include <iostream>
#include <execution>
using namespace std::execution;
int main() {
std::static_thread_pool pool(16);
executor auto ex = pool.executor();
perform_business_logic(ex);
execute(ex, []{ std::cout << "Hello world from the thread pool!"; });
}
It gives a lot of errors.
error: ‘thread_pool’ is not a member of ‘std’
error: ‘executor’ was not declared in this scope
error: ‘ex’ was not declared in this scope