여기 내 중첩 된 클래스 에 직면하고있는 "체스 ++"문제입니다. 농담처럼 보일 수도 있지만 농담이 아니라 진짜 문제입니다. 내 프로젝트에서 동일한 것을 달성하는 방법을 해결하거나 변경하십시오.* std :: shared_ptr로 사용 *
여기서 원하는 것은 신호를내는 것입니다. 신호는 shared_ptr을 인수로 취하는 핸들러를 트리거하는 것으로 선언됩니다. notify() 함수는 * this를 shared_ptr로 변환해야합니다. 위의 코드를 실행하려면 어떻게해야합니까? enable_shared_from_this
에서
std :: shared_from_this – Sneftel
가능한 중복 [boost :: shared \ _ptr 받기] (http://stackoverflow.com/questions/142391/getting-a-boostshared-ptr-for-this) – Sneftel
[ 함수에 대한 참조] (http://en.cppreference.com/w/cpp/memory/enable_shared_from_this/shared_from_this) (클래스가 해당 클래스에서 상속해야 함을 유의하십시오.) – chris