typedef T *QScopedPointer::*RestrictedBool;
This can be done a bit when we move the stars around:
typedef T* QScopedPointer::* RestrictedBool;
In C ++ 11, we will write this more clearly, as
using RestrictedBool = T* QScopedPointer::*;
RestrictedBoolhere declared as a type alias T* QScopedPointer::*. This way, it typedef T *F::boolfails because you cannot override bool:) The name is pretty misleading because the type is not boolean.
T* QScopedPointer::* - . T* QScopedPointer<T, cleanup>, , ,
class QScopedPointer {
operator RestrictedBool() const {
// ^~~~~~~~~~~~~~
// this function returns a `RestrictedBool` = `T* QScopedPointer::*`
return isNull()? Q_NULLPTR : &QScopedPointer::d;
// ^~~~~~~~~~~~~~~~~~
// and this expression has type `T* QScopedPointer::*`
}
T *d;
// ^~~
// the `d` member has type `T*` in the `QScopedPointer` class.
};
QScopedPointer<T>, QScopedPointer ?
QScopedPointer<T, cleanup> QScopedPointer<T, cleanup> QScopedPointer. . . ++ .