diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-03 10:23:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-03 10:23:56 +0200 |
commit | e2f66f921594b7be4af4a058c959557489e86879 (patch) | |
tree | cc44931708b57bd5a761906797c7dee0360d1d6b /src/corelib/global/qtypetraits.h | |
parent | 933bf178aab88ab5df8a68cbf02611d6d8744b1b (diff) | |
parent | 754efa57d89c62d1796e01b407e9222e67450f52 (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/corelib/global/qnamespace.qdoc
src/corelib/io/qwindowspipereader.cpp
src/corelib/io/qwindowspipereader_p.h
src/corelib/statemachine/qstatemachine.cpp
src/corelib/statemachine/qstatemachine_p.h
src/plugins/platforms/xcb/qxcbconnection.h
tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
tests/auto/tools/qmake/tst_qmake.cpp
tests/manual/touch/main.cpp
Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
Diffstat (limited to 'src/corelib/global/qtypetraits.h')
-rw-r--r-- | src/corelib/global/qtypetraits.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/corelib/global/qtypetraits.h b/src/corelib/global/qtypetraits.h index 3a305713e6..488e257e0f 100644 --- a/src/corelib/global/qtypetraits.h +++ b/src/corelib/global/qtypetraits.h @@ -506,6 +506,27 @@ Q_STATIC_ASSERT((!is_unsigned<qint64>::value)); Q_STATIC_ASSERT((!is_signed<quint64>::value)); Q_STATIC_ASSERT(( is_signed<qint64>::value)); +template<class T = void> struct is_default_constructible; + +template<> struct is_default_constructible<void> +{ +protected: + template<bool> struct test { typedef char type; }; +public: + static bool const value = false; +}; +template<> struct is_default_constructible<>::test<true> { typedef double type; }; + +template<class T> struct is_default_constructible : is_default_constructible<> +{ +private: + template<class U> static typename test<!!sizeof(::new U())>::type sfinae(U*); + template<class U> static char sfinae(...); +public: + static bool const value = sizeof(sfinae<T>(0)) > 1; +}; + + } // namespace QtPrivate QT_END_NAMESPACE |