내 소프트웨어에서 클래스의 전달 선언을 사용하고자하므로 typedef가
이 될 수 있으며이를 클래스 전체 선언에 사용할 수 있습니다. 이 같은C++ 클래스 전달 선언 단점?
떨어지게 :
class myclass;
typedef boost::shared_ptr<myclass> pmyclass;
typedef std::list<pmyclass > myclasslist;
class myclass : public baseclass
{
private: // private member declarations
__fastcall myclass();
public: // public member declarations
__fastcall myclass(myclass *Parent)
: mEntry(new myclass2())
{
this->mParent = Parent;
}
const myclass *mParent;
myclasslist mChildren;
boost::scoped_ptr<myclass2> mEntry;
};
그래서 내 질문 :이 방법의 모든 단점이 이 있습니까? 전방 선언으로 소멸자 문제에 대한 토론을 회상하지만, 모든 것을 꺼내지는 못했습니다.
또는 이와 유사한 것을 구현하는 다른 옵션이 있습니까?
감사합니다.
편집 :
5.3.5/5 :
"삭제되는 객체가있는 경우 불완전한 클래스 유형 C++ 표준에서 here
음, 어리 석음에 대해 미안하지만 이전에 읽었습니다. 내 질문은 여기에 있습니다 : 선언 직후에 아무런 문제가 없다고 정의 된 경우, 맞습니까? – Andrew
네, 그게 내가 그것을 읽는 방법입니다. 우리의 컴파일러가 표준을 준수하도록 노력하겠습니다 :-) –