스마트포인터 사용 질문
-
게시물 수정 , 삭제는 로그인 필요
#include <iostream>
int main()
{
std::unique_ptr<int> iUniPtr = std::make_unique<int>(1);
std::shared_ptr<int> iSharedPtr = std::make_shared<int>(2);
std::weak_ptr<int> iWeekPtr = std::make_shared<int>(3);
}
로만 해도 유효하고 스마트포인터를 사용할 수 있는데 #include <memory>를 사용해야하는 이유가 있나요?? #include <memory>가 스마트 포인터는 헤더파일 memory를 include하면 사용할 수 있다라고 설명이 나와있는데 굳이 선언해야하는 이유가 있나요?
#스마트포인터 사용법