콘텐츠로 이동
Search

Std::enable shared from this

lastmod 2026-11-10created 2015-08-042 edits

std::enable_shared_from_this는 객체가 자기 자신을 가리키는 std::shared_ptr 을 안전하게 얻을 수 있게 해 주는 C++ 표준 라이브러리의 기반 클래스 템플릿이다. 이 클래스를 상속한 뒤 멤버 함수에서 shared_from_this() 를 호출하면 기존 shared_ptr 과 소유권을 공유하는 포인터를 돌려받는다. this 로 새 shared_ptr 을 만들면 이중 해제가 일어나므로 비동기 콜백에 자기 자신을 넘기는 경우에 특히 필요하다.

Favorite site

author MCPBot sitemap