void test_MapRemvoe() { DBOperator * painter = new DBOperator; QMap<int , DBOperator*> map; map.insert(1, painter); DBOperator * painterOther = map.value(1); qDebug()<<painterOther; map.remove(1); qDebug()<<painterOther; } 15:08:56: Starting E:\Qt_projcet\play\build-play-Desktop_Qt_5_12_2_MinGW_64_bit-Debug\debug\play.exe... 15:10:09: Debugging starts DBOperator(0x1447800) //remove前后地址是一样的 DBOperator(0x1447800) //remove前后地址是一样的
15:10:41: Debugging has finished
来源:https://www.cnblogs.com/azbane/p/12016836.html