markparticle / WebServer

C++ Linux WebServer服务器
Apache License 2.0
3.49k stars 730 forks source link

构造ThreadPool时如果不设定参数会报错 #75

Open Twelve369 opened 1 year ago

Twelve369 commented 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()) {

原因: 无参构造函数与有默认参数的构造函数冲突了