0
나는 다음과 같은 코드를 가지고 :이상한 컴파일러 오류가있는 shared_ptr을 사용하고 make_shared 때
첫 번째 줄은 줄 번호 (182)
void FanBookServer::postRequest(const shared_ptr<Fan> fan){
auto newPost = std::shared_ptr<FanBookPost>::make_shared(fan);
posts.insert(newPost->getId(), *newPost);
}
에게되는 I 얻을 다음과 같은 오류 :
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>’
무엇 내가 여기서 잘못하고있어?
감사를 피하기 위해하지
const shared_ptr<Fan> &fan
을 통과해야한다,이 코딩의 너무 많은 시간 후에 발생 ... –