0
我有以下代碼:奇怪的編譯錯誤,當
第一行是行號182
void FanBookServer::postRequest(const shared_ptr<Fan> fan){
auto newPost = std::shared_ptr<FanBookPost>::make_shared(fan);
posts.insert(newPost->getId(), *newPost);
}
對於我得到以下錯誤:
FanBookServer.cpp: In member function ‘void mtm::FanBookServer::postRequest(std::shared_ptr<mtm::Fan>)’:
FanBookServer.cpp:183:17: error: ‘make_shared’ is not a member of ‘std::shared_ptr<mtm::FanBookPost>’
FanBookServer.cpp:183:62: error: unable to deduce ‘auto’ from ‘<expression error>’
什麼我在這裏做錯了嗎?
感謝,這種情況太多時間編碼的後... –