mirror of
https://github.com/verilator/verilator.git
synced 2025-01-24 15:24:04 +00:00
Internals: Use auto
instead of SFINAE in return type (#4271). No functional change intended.
This commit is contained in:
parent
191d30cf1c
commit
5aa36357f6
@ -27,19 +27,6 @@
|
|||||||
#include <queue>
|
#include <queue>
|
||||||
#include <thread>
|
#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 {
|
class V3ThreadPool final {
|
||||||
@ -124,8 +111,7 @@ public:
|
|||||||
// specialization as C++11 requires them to be inside namespace scope
|
// specialization as C++11 requires them to be inside namespace scope
|
||||||
// Returns list of future result or void
|
// Returns list of future result or void
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static typename future_type::return_type<T>::type
|
static auto waitForFutures(std::list<std::future<T>>& futures) {
|
||||||
waitForFutures(std::list<std::future<T>>& futures) {
|
|
||||||
return waitForFuturesImp(futures);
|
return waitForFuturesImp(futures);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,9 +119,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static typename future_type::return_type<T>::type
|
static std::list<T> waitForFuturesImp(std::list<std::future<T>>& futures) {
|
||||||
waitForFuturesImp(std::list<std::future<T>>& futures) {
|
std::list<T> results;
|
||||||
typename future_type::return_type<T>::type results;
|
|
||||||
while (!futures.empty()) {
|
while (!futures.empty()) {
|
||||||
results.push_back(V3ThreadPool::waitForFuture(futures.front()));
|
results.push_back(V3ThreadPool::waitForFuture(futures.front()));
|
||||||
futures.pop_front();
|
futures.pop_front();
|
||||||
|
Loading…
Reference in New Issue
Block a user