[Development] Upgrading the sources to C++11 keywords (Q_NULLPTR, etc.)
Thiago Macieira
thiago.macieira at intel.com
Mon Feb 2 23:51:17 CET 2015
On Monday 02 February 2015 14:29:21 Matthew Woehlke wrote:
> > * Q_DECL_EQ_DEFAULT - really discouraged
> >
> >
> > I can't think of any case where you could use this and let the code still
> > compile in C++98, so don't use it
>
> I'd actually like to see this used where possible and sensible, as the
> compiler may be able to optimize better (or it can make POD types that
> otherwise wouldn't be POD).
>
> You can use it like:
>
> class QFoo { QFoo(const QFoo&) Q_DECL_EQ_DEFAULT; }
> #if // '= default' not supported
> QFoo::QFoo(const QFoo& other) { ... }
> #endif
>
> ...that is, provide a definition conditional on Q_DECL_EQ_DEFAULT
> expanding to empty. (This will also make it easy to rip out the old code
> if/when C++11 becomes a requirement for Qt.)
This class is better written as:
class QFoo
{
// implicit copy constructor is fine
};
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list