我是shared_ptr的新手.我有几个关于C++ 0x shared_ptr语法的问题,如下所示:
//first question
shared_ptr<classA>ptr(new classA()); //works
shared_ptr<classA>ptr;
ptr = ?? //how could I create a new object to assign it to shared pointer?
//second question
shared_ptr<classA>ptr2; //could be tested for NULL from the if statement below
shared_ptr<classA> ptr3(new classA());
ptr3 = ?? //how could I assign NULL again to ptr3 so that the if statement below becomes true?
if(!ptr3) cout << "ptr equals null";
Run Code Online (Sandbox Code Playgroud) 我正在使用Boost的unordered_map.是否有unordered_map的同步版本?这是因为我有相当大量的unordered_map并使用锁手动同步这将是非常混乱的.
谢谢.