QCollator: enable move semantics
authorMarc Mutz <marc.mutz@kdab.com>
Wed, 13 Nov 2013 10:37:37 +0000 (11:37 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sun, 17 Nov 2013 08:47:07 +0000 (09:47 +0100)
commit3e803b5180e7059c01c15ea84cadd54982e1a221
tree4ce472724bf7ef840c270f89e9ccffac523b36ae
parent6c04c21c101b70401ad9cb08de1562dc90166e9c
QCollator: enable move semantics

This necessitates adding d==0 checks in QCollator. By documenting that
moved-from instances can only be assigned to or destroyed, we can
limit the functions in which to check for d==0 to the assignment
operator and the destructor.

Doing otherwise would destroy all advantages of move semantics by
introducing a heap allocation to re-populate other.d.

Add a test for this (QCollator didn't have any before).

Change-Id: Ic6ff202072822bebfd5e48259c3d0fa345a63118
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/tools/qcollator.cpp
src/corelib/tools/qcollator.h
tests/auto/corelib/tools/qcollator/qcollator.pro [new file with mode: 0644]
tests/auto/corelib/tools/qcollator/tst_qcollator.cpp [new file with mode: 0644]
tests/auto/corelib/tools/tools.pro