<table><tr><td style="">markg created this revision.<br />markg added reviewers: dfaure, mwolff.<br />Restricted Application added a project: Frameworks.<br />Restricted Application added a subscriber: Frameworks.<br />markg requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D10341" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This allows the compiler to generate:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Move constructor</li>
<li class="remarkup-list-item">Move assingment</li>
<li class="remarkup-list-item">Copy constructor</li>
<li class="remarkup-list-item">Copy assignment</li>
<li class="remarkup-list-item">Destructor</li>
</ul>
<p>This in turn allows further KFileItem optimization throughout KIO and Dolphin.<br />
Also added a quite minimal test to see if move semantics work.</p>
<p>As implemented now it roughly follows the "rule-of-five-default": <a href="http://scottmeyers.blogspot.nl/2014/03/a-concern-about-rule-of-zero.html" class="remarkup-link" target="_blank" rel="noreferrer">http://scottmeyers.blogspot.nl/2014/03/a-concern-about-rule-of-zero.html</a><br />
I was tempted to go for the "rule-of-zero" which means not implementing any of those functions (thus the compiler generates them), but that - in my opinion - is not really clear as it's easy to add the destructor and then be surprised by not having move <br />
semantics anymore.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>New test for move semantics (it passes, would probably pass without as well but just be a copy).<br />
Existing relevant tests (kfileitemtest and kdirmodeltest) all pass just fine.<br />
Running the new "testMove" through callgrind shows that the move constructor and assignment operator are really being used by that test.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>BRANCH</strong><div><div>kfileitem_move</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10341" rel="noreferrer">https://phabricator.kde.org/D10341</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/kfileitemtest.cpp<br />
autotests/kfileitemtest.h<br />
src/core/kfileitem.cpp<br />
src/core/kfileitem.h</div></div></div><br /><div><strong>To: </strong>markg, dfaure, mwolff<br /><strong>Cc: </strong>Frameworks, michaelh, ngraham<br /></div>