[問題]C++/CLI怎麼在Managed class內實做別的class的pointer
認識的人中會c++/cli的人蠻少的,所以到板上詢問一下,請板上的前輩指導一下。
Compiler是Microsoft Visual C++ 2008
我定義一個名稱為A的class
ref class A {
//...
};
然後我想要令另外一個叫B的class的成員中有一個A^型態的指標
(就像是native C++使用A*一樣)
ref class B {
protected:
interior_ptr<A^>pA;
//...
};
Compiler會跳出這個error
error C3160:'cli::interior_ptr<Type>':Managed類別的資料成員不能有這種型別
1> with
1> ['
1> Type=A^
1> ]
1> 內部pointer絕不可配置在gc堆積上
所以看來interior_ptr是沒辦法使用在ref class裡面,但是我不知道有什麼
interior_ptr之外的辦法為A^型態的物件配置指標
各位前輩有什麼好方法可以宣告這麼一個指標,或者有什麼其他的替代方案
感恩大家
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.31.30
→
10/31 13:40, , 1F
10/31 13:40, 1F
→
10/31 13:42, , 2F
10/31 13:42, 2F
→
10/31 19:50, , 3F
10/31 19:50, 3F
→
10/31 19:52, , 4F
10/31 19:52, 4F
→
10/31 21:10, , 5F
10/31 21:10, 5F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章