-4
我有A類:std ::映射值或指針的操作?
struct A
{
std::map<int,int> aa;
}
和B類:
struct B
{
std::map<int,B> bb;
}
如果這些代碼在一個無限循環:
B b;
int inx=0;
while(true)
{
A a;
a.aa[0] = 0;
b.bb[inx] = a;
++inx;
}
請問導致內存泄漏?
我想要a
的所有值複製到b[inx]
。我只是想知道這是std :: map指針的實現嗎?
順便說一下,您使用的是「std :: map',而不是'std :: map '。除此之外,'A'和'B'都不執行'operator []'。 :-) –
oldrinb
請發佈一個完整的編譯示例 - 我的代碼中包含很多錯誤 –
對髒代碼抱歉,我會修復它。 :) 但問題是一樣的。 – naive231