QPointer: some simplifications
- don't write explicit meta functions, use std::conditional - = default the default ctor The class is already not trivially-copyable, so making the default ctor trivial doesn't change the ABI. Change-Id: I8e35bbbb35973c9ff8fc48dfbfc10061de4bfd30 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
908e80d8bb
commit
351c738fc4
@ -54,20 +54,11 @@ class QPointer
|
||||
{
|
||||
Q_STATIC_ASSERT_X(!std::is_pointer<T>::value, "QPointer's template type must not be a pointer type");
|
||||
|
||||
template<typename U>
|
||||
struct TypeSelector
|
||||
{
|
||||
typedef QObject Type;
|
||||
};
|
||||
template<typename U>
|
||||
struct TypeSelector<const U>
|
||||
{
|
||||
typedef const QObject Type;
|
||||
};
|
||||
typedef typename TypeSelector<T>::Type QObjectType;
|
||||
using QObjectType =
|
||||
typename std::conditional<std::is_const<T>::value, const QObject, QObject>::type;
|
||||
QWeakPointer<QObjectType> wp;
|
||||
public:
|
||||
inline QPointer() { }
|
||||
QPointer() = default;
|
||||
inline QPointer(T *p) : wp(p, true) { }
|
||||
// compiler-generated copy/move ctor/assignment operators are fine!
|
||||
// compiler-generated dtor is fine!
|
||||
|
Loading…
Reference in New Issue
Block a user