I’m still very new to move semantics, but just confirming, what’s the motivation for removing the std::move
?
In my local experiments, it looks like taking out the std::move
increments the refcount; could this have performance implications?
No std::move
int main() {
CBlockIndex index;
CBlockIndex* pindex = &index;
std::shared_ptr<const CBlock> pblock(new CBlock);
// (lldb) p pblock
// strong=1 weak=1 {
// __ptr_ = 0x0000000100205290
// }
ConnectTrace connectTrace;
connectTrace.emplace_back(pindex, pblock);
// (lldb) p pblock
// strong=2 weak=1 {
// __ptr_ = 0x0000000100205290
// }
}
With std::move
int main() {
CBlockIndex index;
CBlockIndex* pindex = &index;
std::shared_ptr<const CBlock> pblock(new CBlock);
// (lldb) p pblock
// strong=1 weak=1 {
// __ptr_ = 0x0000000100304150
// }
ConnectTrace connectTrace;
connectTrace.emplace_back(pindex, std::move(pblock));
// (lldb) p pblock
// nullptr {
// __ptr_ = 0x0000000000000000
// }
}