MCPcopy Create free account
hub / github.com/KDE/kdevelop / swap

Function swap

kdevplatform/serialization/indexedstring.cpp:296–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294
295namespace KDevelop {
296void swap(IndexedString& a, IndexedString& b) noexcept
297{
298 using std::swap;
299
300 if (a.m_index == b.m_index) {
301 return;
302 }
303 swap(a.m_index, b.m_index);
304
305 const bool aRc = shouldDoDUChainReferenceCounting(&a);
306 const bool bRc = shouldDoDUChainReferenceCounting(&b);
307
308 if (aRc == bRc) {
309 return;
310 }
311
312 auto noLongerRefCountedIndex = b.m_index;
313 auto newlyRefCountedIndex = a.m_index;
314 if (bRc) {
315 swap(noLongerRefCountedIndex, newlyRefCountedIndex);
316 }
317 deref(noLongerRefCountedIndex);
318 ref(newlyRefCountedIndex);
319}
320}
321
322QUrl IndexedString::toUrl() const

Callers 2

testSwapMethod · 0.50
bench_swapMethod · 0.50

Calls 3

derefFunction · 0.85
refFunction · 0.85

Tested by 2

testSwapMethod · 0.40
bench_swapMethod · 0.40