Internals: Use auto instead of SFINAE in return type (#4271). No functional change intended.

This commit is contained in:
Mariusz Glebocki 2023-06-06 00:53:19 +02:00 committed by GitHub
parent 191d30cf1c
commit 5aa36357f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,19 +27,6 @@
#include <queue>
#include <thread>
namespace future_type {
template <typename T>
struct return_type {
typedef std::list<T> type;
};
template <>
struct return_type<void> {
typedef void type;
};
} // namespace future_type
//============================================================================
class V3ThreadPool final {
@ -124,8 +111,7 @@ public:
// specialization as C++11 requires them to be inside namespace scope
// Returns list of future result or void
template <typename T>
static typename future_type::return_type<T>::type
waitForFutures(std::list<std::future<T>>& futures) {
static auto waitForFutures(std::list<std::future<T>>& futures) {
return waitForFuturesImp(futures);
}
@ -133,9 +119,8 @@ public:
private:
template <typename T>
static typename future_type::return_type<T>::type
waitForFuturesImp(std::list<std::future<T>>& futures) {
typename future_type::return_type<T>::type results;
static std::list<T> waitForFuturesImp(std::list<std::future<T>>& futures) {
std::list<T> results;
while (!futures.empty()) {
results.push_back(V3ThreadPool::waitForFuture(futures.front()));
futures.pop_front();