I'm trying to implement my own version of parallel for using https://github.com/Fdhvdu/ThreadPool as the backend thread pool
I'm splitting up the task to several slices and launching a thread with the following function:
template <typename Callable>
void launchRange(int id, Callable func, int k1, int k2)
{
for (int k = k1; k < k2; k++) {
func(k);
}
}
The problem I'm having is how to pass this Callable
to the thread pool
The relevant part is:
poolPtr->add(launchRange, func, i1, i2);
But I keep getting compilation errors. The error is:
...\ithreadpoolitembase.hpp(36): error C2027: use of undefined type 'std::tuple<conditional<_Test,void(__cdecl *&)(int),_Ty>::type,conditional<_Test,int&,int>::type,conditional<_Test,int&,int>::type>'
with
[
_Ty=void (__cdecl *)(int)
]
The interface for add
is
template<class Func,class ... Args>
inline thread_id add(Func &&func,Args &&...args);
I'm using Visual Studio 2017 Community 15.4 with /std:c++17
Aucun commentaire:
Enregistrer un commentaire