[Development] QtCS: Notes from Modern C++ session
Marc Mutz
marc.mutz at kdab.com
Sun Jun 14 14:00:03 CEST 2015
On Sunday 14 June 2015 12:06:21 Knoll Lars wrote:
[ regarding = default, = delete ]
> The main place where we use this feature is anyway with Q_DISABLE_COPY. So
> for now, I don't think it's a huge problem if we can't use those.
That's = delete, yes, and you can always make those into linker errors by
leaving the function undefined (and sometimes, for member functions, into a
compiler error by marking them private). Q_DECL_EQ_DELETE then just lifts
those errors to an earlier stage, with a better error message. No
functionality is lost.
= default, however, has no workaround. We can't even use Q_DECL_EQ_DELETE,
because it qualitatively changes the nature of the special member function
it's applied to: in one case, it's user-provided, in the other, compiler-
synthesized. That can turn non-trivial types into trivial ones, and as I
recently learned from Thiago, that may change the way an object of the type is
passed by-value to functions.
So, we might as well remove Q_DECL_EQ_DEFAULT, I think.
Thanks,
Marc
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
More information about the Development
mailing list