From 16d1ddfc42732afc6ba90df66042c7ff4be348c2 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 11 Mar 2017 19:39:32 +0100 Subject: moc: Support signals that return movable-only type By adding std::move where it makes sense. This is not only good for move-only types, but for any type which can be moved as it saves copies of the return value in any case. [ChangeLog][moc] Move-only types are now supported as return types of signals and slots. Change-Id: Idc9453af993e7574a6bddd4a87210eddd3da48a9 Reviewed-by: Marc Mutz --- src/corelib/kernel/qobjectdefs_impl.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index bd08ca1763..3f5f2e78bb 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -90,14 +90,9 @@ namespace QtPrivate { explicit ApplyReturnValue(void *data_) : data(data_) {} }; template - void operator,(const T &value, const ApplyReturnValue &container) { - if (container.data) - *reinterpret_cast(container.data) = value; - } - template void operator,(T &&value, const ApplyReturnValue &container) { if (container.data) - *reinterpret_cast(container.data) = value; + *reinterpret_cast(container.data) = std::forward(value); } template void operator,(T, const ApplyReturnValue &) {} -- cgit v1.2.3