Open Twelve369 opened 1 year ago
报错信息: include/c++/11/ext/new_allocator.h:162:11: error: call of overloaded ‘ThreadPool()’ is ambiguous 162 | { ::new((void *)p) _Up(std::forward<_Args>(args)...); } | ^~~~~~~~~~~~~~ In file included from main.cpp:2: threadpool.h:37:5: note: candidate: ‘constexpr ThreadPool::ThreadPool()’ 37 | ThreadPool() = default; | ^~~~~~ threadpool.h:17:14: note: candidate: ‘ThreadPool::ThreadPool(size_t)’ 17 | explicit ThreadPool(sizet threadCount = 8): pool(std::make_shared()) {
原因: 无参构造函数与有默认参数的构造函数冲突了
报错信息: include/c++/11/ext/new_allocator.h:162:11: error: call of overloaded ‘ThreadPool()’ is ambiguous 162 | { ::new((void *)p) _Up(std::forward<_Args>(args)...); } | ^()) {
~~~~~~~~~~~~~ In file included from main.cpp:2: threadpool.h:37:5: note: candidate: ‘constexpr ThreadPool::ThreadPool()’ 37 | ThreadPool() = default; | ^~~~~~ threadpool.h:17:14: note: candidate: ‘ThreadPool::ThreadPool(size_t)’ 17 | explicit ThreadPool(sizet threadCount = 8): pool(std::make_shared原因: 无参构造函数与有默认参数的构造函数冲突了